首页 文章

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

提问于
浏览
3

可能有几个人问这个问题,我一直在寻找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 回答

  • 0

    如果您按照Google Map文档并手动安装SDK,您可能已将这三个框架添加到您的项目中,只需右键单击Xcode中的框架然后 Show in 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"
      }
    }
    

相关问题