How to fix"AIRMap" was not found in the UIManager error in react native?
Asked Answered
P

4

9

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

This error is located at: in AIRMap (at MapView.js:760) in MapView (at App.js:25) in RCTView (at View.js:43) in App (at renderApplication.js:32) in RCTView (at View.js:43) in RCTView (at View.js:43) in AppContainer (at renderApplication.js:31)

how to fix this error in react native ios ?

Pyonephritis answered 13/7, 2018 at 5:14 Comment(3)
Did you fix it? :( I couldn't make it work. Could you share how you fix it?Holmen
Same error, no fixes tll now.Pyrogenous
Did you find a solution since then? @ajnasaskar ?Ruella
E
1

Add to ios/YOUR_PROJECT_NAME/AppDelegate.m

@import GoogleMaps; //add this line if you want to use Google Maps

and

[GMSServices provideAPIKey:@"_YOUR_API_KEY_"]; // add this line using the api key obtained from Google Console

Exiguous answered 15/8, 2018 at 6:13 Comment(1)
I have tried this, but still same error. @KateYeEum did you find a solution?Yellowwood
T
0

I had this error also, and i fixed in this way:

  1. In your project, go to package.json
  2. At dependencies react native maps should be like this: "react-native-maps": "https://github.com/react-community/react-native-maps.git"
  3. Go to terminal/cmd and run npm-install
  4. Dont forget to link: "react-native link react-native-maps"

  5. Then: react-native run-ios/android

Because there is only one person that is allowed to publish at npm, we should use Git for the latest updates etc.

Thingumajig answered 18/4, 2019 at 11:45 Comment(0)
H
0

I have added following script to package.json. Its worked for me.

{
  "name": "your-app",
  "scripts": {
    "postinstall": "./node_modules/react-native-maps/enable-google-maps REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL"
  }
}
Hippo answered 26/5, 2020 at 10:56 Comment(0)
G
-7
/*----------------Install----------------*/

npm install react-native-maps --save

/*----------------Get a Google Maps API key----------------*/

/*----------------Write this in Pod file----------------*/

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target '_YOUR_PROJECT_TARGET_' do
    rn_path = '../node_modules/react-native'
    rn_maps_path = '../node_modules/react-native-maps'

# See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
    pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
]

# React Native third party dependencies podspecs
pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
# If you are using React Native <0.54, you will get the following error:
    # "The name of the given podspec `GLog` doesn't match the expected one `glog`"
# Use the following line instead:
    #pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"

# react-native-maps dependencies
pod 'react-native-maps', path: rn_maps_path
pod 'react-native-google-maps', path: rn_maps_path  # Remove this line if you don't want to support GoogleMaps on iOS
pod 'GoogleMaps'  # Remove this line if you don't want to support GoogleMaps on iOS
pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS
end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
    target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.name == "React"
    target.remove_from_project
end
end
end



/*----------------Write this in AppDelegate .m----------------*/

@import GoogleMaps

In didFinishLaunchingWithOptions method
    [GMSServices provideAPIKey:@"_YOUR_API_KEY_"];

/*----------------Now rut it with simulator or iOS device----------------*/

/*----------------

for more you can take reference of this :
https://github.com/react-community/react-native-maps

----------------*/
Guilt answered 7/8, 2018 at 11:30 Comment(2)
Nice copy paste. Nothing useful, same documentation is pasted here.Pyrogenous
I am downvoting because you have pasted code without explaining it.Si

© 2022 - 2024 — McMap. All rights reserved.