简体   繁体   中英

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...

Invariant Violation: requireNativeComponent: "AIRMap" was not found in the UIManager.

This error is located at: in AIRMap (at MapView.js:760) in MapView (at 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

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

Still getting the same error...

I have not added this to package.json, as I am unsure what path it is asking for? I found this at 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

在此处输入图片说明

在此处输入图片说明

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

 { "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. 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. Then also add the following line to the top of your podfile.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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