简体   繁体   English

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

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

It might have been a few people asking this question, I have been looking all over Github, but can't find a solution that works for installing React Native Maps...可能有几个人在问这个问题,我一直在 Github 上找遍了,但找不到适用于安装 React Native Maps 的解决方案......

Invariant Violation: requireNativeComponent: "AIRMap" was not found in the UIManager.不变违规:requireNativeComponent:在 UIManager 中找不到“AIRMap”。

This error is located at: in AIRMap (at MapView.js:760) in MapView (at Home.js:118)此错误位于:在 AIRMap (在 MapView.js:760) 在 MapView (在 Home.js:118)

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

I have tried:我试过了:

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

Followed this guide to add Maps SDK for iOS manually without CocoaPods: https://developers.google.com/maps/documentation/ios-sdk/start按照本指南手动添加 iOS 版 Maps SDK,无需 CocoaPods: https : //developers.google.com/maps/documentation/ios-sdk/start

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

Still getting the same error...仍然得到同样的错误...

I have not added this to package.json, as I am unsure what path it is asking for?我没有将它添加到 package.json,因为我不确定它要求什么路径? I found this at https://github.com/react-community/react-native-maps/blob/master/docs/installation.md我在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"
  }
}

If you follow the Google Map doc and install the SDK manually, you may have add those three frameworks to your project, just right click the framework in Xcode and then Show in Finder , you can find the framework file in finder如果您按照Google Map doc手动安装SDK,您可能已经将这三个框架添加到您的项目中,只需在Xcode中右键单击该框架,然后在Finder中显示,您就可以在finder中找到该框架文件

在此处输入图片说明

在此处输入图片说明

and in my case , the REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL refers to my ios directory, the related path is ./ios , just add this to the package.json file and run npm install就我而言, 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" } }

The other answer may no longer be relevant for RN >0.60.另一个答案可能不再与 RN >0.60 相关。 Be sure to follow the instructions for installation here: https://github.com/react-native-community/react-native-maps/blob/master/docs/installation.md which includes the appdelegate.m changes and the podfile changes.请务必按照此处的安装说明进行操作: https : //github.com/react-native-community/react-native-maps/blob/master/docs/installation.md ,其中包括 appdelegate.m 更改和 podfile 更改. Then also add the following line to the top of your podfile.然后还将以下行添加到 podfile 的顶部。

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

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

相关问题 错误:在 UIManager 中找不到“ARTShape” - React native - Error : "ARTShape" was not found in the UIManager - React native React-Native-SVG 错误:不变违规:requireNativeComponent:在 UIManager 中找不到“RNSVGGroup” - React-Native-SVG Error: Invariant Violation: requireNativeComponent: "RNSVGGroup" was not found in the UIManager 反应就像地图的按钮。 json资料 - react like button for map. json data 错误:尝试在实现react-native-maps时注册两个具有相同名称AIRMap的视图 - Error: Tried to register two views with the same name AIRMap… while implementing react-native-maps 将本机UIManager.measureInWindow坐标反应为android MotionEvent坐标 - React native UIManager.measureInWindow coords to android MotionEvent coords 在 UIManager 中找不到 requireNativeComponent - requireNativeComponent was not found in UIManager 在 UIManager 中找不到 RNCSafeAreaView - RNCSafeAreaView was not found in the UIManager 在 UIManager 中找不到“RNCSafeAreaView” - "RNCSafeAreaView" was not found in the UIManager requireNativeComponent:在 UIManager 中找不到“RNSScreenStackHeaderConfig” - requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager React 使用 map 迭代嵌套数组/对象。 渲染每个地图功能是否必须返回? - React iterate nested arrays/objects with map. Is return mandatory to render each map function?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM