react-native-maps: ios build fails on v1.22.6 - RN 0.79.1 - new architecture disabled
Summary
ios build fails:
Reproducible sample code
<MapView />
Steps to reproduce
- Use se the provided /example project:
RCT_NEW_ARCH_ENABLED=0 pod installin /ios- XCode build
Expected result
ios build completes
Actual result
See screenshot attached.
React Native Maps Version
From 1.22.0…1.22.6
What platforms are you seeing the problem on?
iOS (Apple Maps), iOS (Google Maps)
React Native Version
0.79.1, Fabric disabled: RCT_NEW_ARCH_ENABLED=0
What version of Expo are you using?
Not using Expo
Device(s)
simulator
Additional information
Pod install ✅
Pod install took 47 [s] to run
🔧 Patched @import in: /app/ios/Pods/Google-Maps-iOS-Utils/Sources/GoogleMapsUtilsObjC/include/GMSMarker+GMUClusteritem.h
🔧 Patched @import in: /app/ios/Pods/Google-Maps-iOS-Utils/Sources/GoogleMapsUtilsObjC/include/GMUGeoJSONParser.h
🔧 Patched @import in: /app/ios/Pods/Google-Maps-iOS-Utils/Sources/GoogleMapsUtilsObjC/include/GMUPolygon.h
🔧 Patched @import in: /app/ios/Pods/Google-Maps-iOS-Utils/Sources/GoogleMapsUtilsObjC/include/GMUWeightedLatLng.h
🔧 Patched @import in: /app/ios/Pods/GoogleMaps/Maps/Sources/GMSEmpty.h
Integrating client project
Pod installation complete! There are 112 dependencies from the Podfile and 148 total pods installed.
Compilation ❌
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 19
- Comments: 79 (4 by maintainers)
For everyone else stumbling on this issue you need to update your podfile:
Nevermind @gusparis. I’ve already found the fix. It was just a case of reading the Podfile of the example project.
You need to add the following to the Podfile:
Right beneath:
Perhaps, it’s a good idea to update the installation instructions for use with Fabric support.
@gusparis It didn’t work. For reference, I created a brand new project using the new architecture and RN 0.79.0 (Not using expo).
Podfile is the following:
I installed it like this:
Opened Xcode afterwards to build, which results in the following error:
Use of '@import' when C++ modules are disabled, consider using -fmodules and -fcxx-modulesin the fileGoogle-Maps-iOS-Utils/Sources/GoogleMapsUtilsObjC/include/GMUWeightedLatLng.hAnd I keep getting this issue while installing pod files, I added the lines from above, also on a new created expo project.
❌ (/my-app/ios/Pods/Google-Maps-iOS-Utils/Sources/GoogleMapsUtilsObjC/include/GMUWeightedLatLng.h:19:1)
17 | 18 | #import <CoreLocation/CoreLocation.h>
The solution to update the Podfile is not ideal if you are using Continuous Native Generation (CNG) with Expo right? Since the idea is to add your native folders to .gitignore.
I have the same issue as @kstolk.
I am using:
Pod file: As mentioned in the official docs here
This worked for me
@angelica-snowit @LPitonakova the pod references changed; i.e. this is my latest successful iOS build config using RN 0.79.2 and RN maps 1.23.8:
hey whoever facing this issue with latest react native just do this first add this in pod file rn_maps_path = ‘…/node_modules/react-native-maps’ pod ‘react-native-maps’, :path => rn_maps_path pod ‘react-native-google-maps’, :path => rn_maps_path pod ‘react-native-maps-generated’, :path => rn_maps_path then make build with Xcode …when it fails go to specific error file and change(in my case I got error in Google-Maps-iOS-Utils/Sources/GoogleMapsUtilsObjC/include/GMUWeightedLatLng.h file) //@import GoogleMaps; replace this with below line #import <GoogleMaps/GoogleMaps.h> this will work
Same issue here: "Use of ‘@import’ when C++ modules are disabled, consider using -fmodules and -fcxx-modules" on react native: 0.78.2 and “react-native-maps”: “1.22.6”.
@MadeinFrance Downgrade react-native-maps to v1.20.1. It worked for me
This fixed it for me in expo. Both the code you provided and adding the custom pod specs.
Temporary custom expo plugin for these fixes!
If you’re using expo it’ll probably overwrite your Podfile everytime you rebuild or use eas to ship your app. So i made a temporary plugin file you can add to your app.config to add these fixes. This should be seen as a temporary fix tho!
react-native-maps-fix-plugin.jsin the root of your expo project with this codeapp.config.jsonexpo.plugins"./react-native-maps-fix-plugin"Now it should add the fixes mentioned here everytime you rebuild your ios directory ✌️
this is such a mess, jesus christ.
This now should be fixed with the latest release v1.23.0
it took too much effort trying to get the lib migrated to monorepo to avoid all the hacks around pods, babel, metro … but I couldn’t get it working with semantic-release/npm
anyhow at least now we have a single podspec file that should allow generated pod to be included without it being manually linked.
@SKHRAPP please remove the carat ‘^’ before version … it is for targeting higher version than given so remove that and try to do the rest
If we don’t have any effective solution yet, I have small trick downgrading react-native-maps version to 1.20.1 remember remove ‘^’ symbol in package.json 😃, remove node_modules and pod deintegrate is also necessary. If you guy downgrade successful, we don’t need to add anykind of new code in Podfile just revert and follow the installation steps on the instruction and everything is ok.
I’m using:
Remember my solution is just temporary and for anyone who don’t need to use new feature in react-native-maps version.
@fedpre yes remove the import google maps instead replace it with #import <GoogleMaps/GoogleMaps.h> just changing the format of importing worked out for me
If you have the old arch and still facing issue then please check dependenacy is having caret sign like “react-native-maps”: “^1.15.6”, and if so remove it do install using yarn add react-native-maps@1.15.6 for example.
Getting Error after adding the below code in podfile !!
rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-maps', :path => rn_maps_path pod 'react-native-google-maps', :path => rn_maps_path pod 'react-native-maps-generated', :path => rn_maps_pathAlso Added the code that @mHvNG suggested above.
Any Idea why this is so ?
Thank you all for your insights.
I’m using expo and encounter the exact same message… Any idea how to fix this there? The pod based approach is getting overwritten by expo on prebuild.
@gusparis same issues:
@salah-ghanim I experience the issue on /master latest commit using Cocoapods 1.14.3 targeting iOS sim 18.4 on XCode 16.2
Q:
@SKHRAPP just downgrade to 1.20.1 while the issue persist please
When I run from terminal and build in xcode, it is okay working no problem, but when i try to archive, I face the problem saying
Showing All Errors Only Target ‘React-Core-f955c501-React-Core_privacy’ (project ‘Pods’) has create directory command with output ‘Library/Developer/Xcode/DerivedData/googleMaps-dgpsomhuctxnfvdtdboprqhjywtu/Build/Intermediates.noindex/ArchiveIntermediates/googleMaps/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/React-Core_privacy.bundle’
Showing All Errors Only Target ‘React-Core.common-React-Core_privacy’ (project ‘Pods’) has create directory command with output ‘Library/Developer/Xcode/DerivedData/googleMaps-dgpsomhuctxnfvdtdboprqhjywtu/Build/Intermediates.noindex/ArchiveIntermediates/googleMaps/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/React-Core_privacy.bundle’
there is no any copied bundle file to delete in build phase
I tried so many ways, it is impossible to solve this issue, i can’t archive and upload my app to app connect. any way to solve this issue. I tried in brend new project and existing one.
@nahuelprinsich you need to add this code here https://github.com/react-native-maps/react-native-maps/issues/5400#issuecomment-2798827292 and it will go away
My issue is that adding that code I then have another problem after the build completes 😢
@gusparis Doesn’t help either. I’ve removed the
Podfile.lockfile, deletedpodsfolder to be safe and cleaned the build folder and I still get the error when I moved the pods beforeuse_native_modules.Edit: And executed the
pod cache clean --allcommand.hey @MadeinFrance! yeah, like I commented before that solves pod install issue, but then later the app is not running (at least for me). Did you make it to run?
@salah-ghanim I think this is related to your comment about autolinking. I tried installing without the changes to the Expo config plugin, but I had to manually change it to add the generated pod to Podfile to make it work. Do you think there’s a way to fix this in react-native-maps, or should we update the upstream Expo plugin for this?
I confirmed that this is happening for me as well (non-Expo project), even on a brand new React Native cli project. I had to do the recommended pod file patch fix as found by @Jamal-Ud-Din-hub . That worked for me (I also had to add sudo file edit permissions from my command line in order for those files to be edited with a
npx pod-install.I would not recommend editing the files yourself in Xcode, because then all of your teammates would have to do this, and also any automated CI builds you have would not be able to do that, so they would fail.
@quentin23soleil it is. Just check out the installation instructions. https://github.com/react-native-maps/react-native-maps/blob/master/docs/installation.md
You now have to add the plugin manually to your app config. This changed in the Fabric architecture update, because Expo team wanted to move the plugin maintenance downstream to this repository, rather than have it built-in to Expo. Which makes sense, cause when there are breaking changes like this it’s easier to use the plugin that’s part of the
react-native-mapspackage and menat to work with that version, rather than try to synchronize thereact-native-mapsversion andexpoversion so that you have the right (hidden/default) plugin.Sorry but do we have another solutions I try the @mHvNG solution but I still get a tons of RNMapsMarkerView, I’m using
Non Expo RN: 0.77 react-native-maps: 1.20.1
Small trick like remove node_modules, Pod, Podfile.lock; pod deintegrate doesn’t work too 😦((
It works, thanks!
That was it! Thank you!
for @kstolk @spyshower and @mHvNG, delete Podfile.lock and do
pod cache clean --allthenpod install --repo-update. that should get the install done. as for us @MadeinFrance, I’m stuck at that point, had to revert back to 1.20.1 and specify Map version like Google was requiring to bypass their check