I installed react-native-maps in my project in Android works perfectly but in I always the error appears, piles well but has an error when executing in ios:
console.error: "react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS".
"dependencies": {
"react": "16.0.0-alpha.6",
"react-native": "0.48.4",
"react-native-maps": "^ 0.17.1",
... }
I installed react-native-maps in my project in Android works perfectly but in I always the error appears, piles well but has an error when executing in ios:
console.error: "react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS".
"dependencies": {
"react": "16.0.0-alpha.6",
"react-native": "0.48.4",
"react-native-maps": "^ 0.17.1",
... }
Share
Improve this question
edited Jan 22, 2019 at 7:13
Cœur
38.8k25 gold badges206 silver badges278 bronze badges
asked Nov 8, 2017 at 20:07
sebastian gamboasebastian gamboa
592 silver badges10 bronze badges
2 Answers
Reset to default 5I had faced this problem a week ago, and I solved it yesterday.
First of all, My file structure like below and my version totally same as you.
MyApp--- ios
|
- android
|
- js- node-modules
|
- index.js
|
- etc...
Maybe it is little different with you, but just a file structure.
I use pod to install react-native-maps and I never link with react-native. After you install react-native-maps, you can use iOS native map now. Make sure you already able to use iOS map after which I will take you through.
In your xcode project left sidebar click right and click
Add files to "your project"
and choose node_modules/react-native-maps/lib/ios/AirGoogleMapGo to your project => target => Build Setting => Header Search Paths and double click to add path
$(SRCROOT)/../js/node_modules/react-native-maps/lib/ios
(this is my file structure) and turn non-recursive to recursive.
If your file structure is following official like react-native, you should add path like this$(SRCROOT)/../node_modules/react-native-maps/lib/ios
.
That is done, I hope it will help you.
Comment PROVIDER_GOOGLE and automatically react native maps will use iOS maps.
<MapView
style={styles.map}
//provider={PROVIDER_GOOGLE}
/>