react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS
Asked Answered
V

4

11

I'm trying to use google maps on iOS and I get this error:

react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.

Error Image

I'm using react-native.maps https://github.com/react-community/react-native-maps

I followed the install instructions, in Android it worked perfectly but it doesn't in IOS

macOS: 10.14.1 (18B75)

dependencies {

"react": "16.5.0",

"react-native": "0.57.1",

"react-native-maps": "^0.22.1",

}
Verine answered 22/11, 2018 at 18:16 Comment(3)
are you using cocoapods? did you really follow the instructions for iOS? they are not the same and if you want to render google maps, it has extra steps.Kyphosis
@HelmerBarcos yes I'm using cocoapods, I added the AirGoogleMaps folder to my xcworkspace, added to mi Libraries folder the AirMaps.xcodeproj and added to my AppDelegate.m #import <GoogleMaps/GoogleMaps.h> [GMSServices provideAPIKey:@"_API_KEY_"];Venereal
Possible duplicate of AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS RN48Selectee
P
7

ok I just had the same problem, so here is how i fixed it:

First follow this answer here:

https://github.com/react-community/react-native-maps/issues/693#issuecomment-262656417

Then you would need to go inside xcode > build settings > Preprocessor Macros > add HAVE_GOOGLE_MAPS=1

P.S inside actual component i used

import MapView from "react-native-maps";

<MapView provider={MapView.PROVIDER_GOOGLE} style={styles.map} />

my styles > map: { position: "absolute", top: 0, left: 0, bottom: 0, right: 0 }

Hope this helps ;)

Phung answered 27/11, 2018 at 18:12 Comment(1)
HI, the issue I'm having is there's no option for preprocessor macros, talkies of adding the valueWaterscape
S
12

ADD THIS CONDITION TO YOUR <MAPVIEW

provider={Platform.OS === 'android' ? PROVIDER_GOOGLE : PROVIDER_DEFAULT}

Surrebutter answered 11/12, 2020 at 13:43 Comment(0)
P
7

ok I just had the same problem, so here is how i fixed it:

First follow this answer here:

https://github.com/react-community/react-native-maps/issues/693#issuecomment-262656417

Then you would need to go inside xcode > build settings > Preprocessor Macros > add HAVE_GOOGLE_MAPS=1

P.S inside actual component i used

import MapView from "react-native-maps";

<MapView provider={MapView.PROVIDER_GOOGLE} style={styles.map} />

my styles > map: { position: "absolute", top: 0, left: 0, bottom: 0, right: 0 }

Hope this helps ;)

Phung answered 27/11, 2018 at 18:12 Comment(1)
HI, the issue I'm having is there's no option for preprocessor macros, talkies of adding the valueWaterscape
B
4

Or, if the provider isn't important for you, just remove following prop in MapView:

provider={MapView.PROVIDER_GOOGLE}

It solved the issue for me

Bowline answered 14/2, 2020 at 20:28 Comment(0)
A
0

Install the library react-native-maps. Follow the link instructions

https://github.com/react-native-maps/react-native-maps/blob/master/docs/installation.md
Antirrhinum answered 4/10, 2021 at 9:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.