Installing React Native Map. AIRMap not found in UIManager
Asked Answered
C

2

9

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"
  }
}
Cb answered 17/9, 2018 at 20:57 Comment(0)
S
3

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

enter image description here

enter image description here

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"
  }
}
Stateroom answered 21/11, 2018 at 8:52 Comment(0)
R
1

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'

Renfrew answered 5/11, 2019 at 12:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.