可能有几个人问这个问题,我一直在寻找Github,但找不到适用于安装React Native Maps的解决方案......
不变违规:requireNativeComponent:在UIManager中找不到“AIRMap” . 此错误位于:MapMap中的AIRMap(MapView.js:760)中(在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
按照本指南手动添加Maps SDK for iOS而不使用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"
}
}
1 回答
如果您按照Google Map文档并手动安装SDK,您可能已将这三个框架添加到您的项目中,只需右键单击Xcode中的框架然后 Show in Finder ,您就可以在finder中找到框架文件
在我的情况下,
REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL
指向我的ios目录,相关路径是./ios
,只需将其添加到package.json
文件并运行npm install