mapbox / mapbox/mapbox-navigation-ios
Xcode build fails with duplicate embed errors for Turf, MapboxCoreMaps & MapboxCommon when integrating Mapbox Navigation v3 via SPM alongside @rnmapbox/maps CocoaPods
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 918
- Forks
- 326
- Avg merge
- 1h 16m
- Merged PRs (30d)
- 3
Description
Description
When I add the Mapbox Navigation SDK v3 (via Swift Package Manager) into an existing React Native iOS project that already uses rnmapbox-maps (via CocoaPods), the Xcode 15 build fails with “Multiple commands produce” errors for Turf.framework, MapboxCoreMaps.framework and MapboxCommon.framework. I’ve tried patching the CocoaPods embed script and looking for an “Embed Swift Package Libraries” phase to disable, but nothing stops the duplicate-embed.
⸻
Steps to Reproduce
1. Setup React Native map:
- Add rnmapbox-maps to your Podfile and run pod install.
2. Add Navigation via SPM:
- In Xcode, File → Add Packages…
- URL: https://github.com/mapbox/mapbox-navigation-ios.git
- Version: Up to Next Major Version 3.9.1
3. Configure tokens & permissions (per Mapbox docs)
4. Build in Xcode 15 (macOS Sonoma)
You will see errors like:
Multiple commands produce '/…/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/Turf.framework'
Multiple commands produce '/…/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/MapboxCoreMaps.framework'
Multiple commands produce '/…/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/MapboxCommon.framework'
⸻
What I Expected
- Each framework should be embedded only once (either via CocoaPods or via SPM)
- Build succeeds without manual script hacks
⸻
What Happened Instead
- CocoaPods’ [CP] Embed Pods Frameworks phase and Xcode’s SPM embed phase both try to copy the same frameworks.
- Attempts to patch Pods-MyApp-frameworks.sh to skip those frameworks did not resolve the “Multiple commands produce” errors.
- I do not see any “Embed Swift Package Libraries” or “Embed Package Products” phase in my target’s Build Phases to disable.
⸻
Build Log Snippet
error: Multiple commands produce '/…/Frameworks/Turf.framework'
note: Target 'MyApp' has copy command from '…/Turf.xcframework/ios-arm64_x86_64-simulator/Turf.framework' to '/…/Frameworks/Turf.framework'
note: That command depends on command in Target 'MyApp': script phase “[CP] Embed Pods Frameworks”
...
⸻
Attempts at a Fix
- Patching install_framework() in Pods-MyApp-frameworks.sh to return early for Turf/MapboxCoreMaps/MapboxCommon
- Searching for and disabling any SPM embed phase in Xcode UI
None have eliminated the duplicate-embed errors.
⸻
Request
Could you advise on the official way to integrate Mapbox Navigation v3 via SwiftPM and rnmapbox-maps via CocoaPods in the same project, so that Turf, MapboxCoreMaps and MapboxCommon are only embedded once and the build succeeds?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Podfile, the generated Pods-MyApp-frameworks.sh script, and the app target’s Xcode Build Phases while reproducing the Xcode 15 build. Compare the CocoaPods and Swift Package Manager embed commands for Turf, MapboxCoreMaps, and MapboxCommon; done means the integration builds with each framework embedded only once.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, swift
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100