繁体   English   中英

安装 React Native Map。 在 UIManager 中找不到 AIRMap

[英]Installing React Native Map. AIRMap not found in UIManager

可能有几个人在问这个问题,我一直在 Github 上找遍了,但找不到适用于安装 React Native Maps 的解决方案......

不变违规:requireNativeComponent:在 UIManager 中找不到“AIRMap”。

此错误位于:在 AIRMap (在 MapView.js:760) 在 MapView (在 Home.js:118)

  "react-native": "^0.57.0-rc.4",
  "react-native-maps": "^0.21.0",

我试过了:

rm -rf ios android node_modules
npm install
react-native upgrade
react-native link

libAirMaps.a is added in Build Phases
AirGoogleMaps and AirMaps is added to Libraries

按照本指南手动添加 iOS 版 Maps SDK,无需 CocoaPods: https : //developers.google.com/maps/documentation/ios-sdk/start

添加@import GoogleMaps; [GMSServices provideAPIKey:@"_YOUR_API_KEY_"]; AppDelegate.m

仍然得到同样的错误...

我没有将它添加到 package.json,因为我不确定它要求什么路径? 我在https://github.com/react-community/react-native-maps/blob/master/docs/installation.md找到了这个

{
  "name": "your-app",
  "scripts": {
    "postinstall": "./node_modules/react-native-maps/enable-google-maps REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL"
  }
}

如果您按照Google Map doc手动安装SDK,您可能已经将这三个框架添加到您的项目中,只需在Xcode中右键单击该框架,然后在Finder中显示,您就可以在finder中找到该框架文件

在此处输入图片说明

在此处输入图片说明

就我而言, REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL指的是我的 ios 目录,相关路径是./ios ,只需将其添加到package.json文件并运行npm install

 { "name": "your-app", "scripts": { "postinstall": "./node_modules/react-native-maps/enable-google-maps ./ios" } }

另一个答案可能不再与 RN >0.60 相关。 请务必按照此处的安装说明进行操作: https : //github.com/react-native-community/react-native-maps/blob/master/docs/installation.md ,其中包括 appdelegate.m 更改和 podfile 更改. 然后还将以下行添加到 podfile 的顶部。

源' https://github.com/CocoaPods/Specs.git '

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM