Repository navigation
Conversation
CocoaPods only embeds the frameworks of pods, so a dynamic framework that a Swift package adds through spm_dependency is linked but missing from the app bundle, and the app fails at launch with dyld "Library not loaded". Add them to the embed frameworks script, and remove the pod's duplicate xcframework signature that fails Xcode 26 archives. The new embed_frameworks argument names frameworks that differ from their product (Sentry-Dynamic is Sentry.framework).
cipolleschi
approved these changes
Oct 1, 2026
cipolleschi
left a comment
Contributor
There was a problem hiding this comment.
Thanks for fixing this!
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D122772893. |
cortinico
approved these changes
Oct 1, 2026
cortinico
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
@cipolleschi merged this pull request in d787826. |
mfazekas
added a commit
to rnmapbox/maps
that referenced
this pull request
Oct 18, 2026
… can react/react-native#58781 makes spm_dependency embed package frameworks through install_spm_framework, defaulting to the products (MapboxMaps, a static product). Where it's supported, pass MapboxCommon, MapboxCoreMaps and Turf as embed_frameworks, and skip our framework_paths_by_config entries when the app has an embed script anyway (a framework or a dynamic xcframework), so they aren't embedded twice.
5 of 8 tasks
mfazekas
added a commit
to rnmapbox/maps
that referenced
this pull request
Oct 19, 2026
…hive (#4368) * fix(ios): make the Swift Package Manager opt-in build, launch and archive $RNMapboxMapsSwiftPackageManager failed in several ways with static pods: - rnmapbox-maps couldn't find the package's modules (no such module 'MapboxMaps'); - the product was linked into both the pod and the app target (duplicate symbols); - the dynamic MapboxCommon, MapboxCoreMaps and Turf frameworks weren't embedded (dyld crash at launch); - Xcode 26 archives failed with "MapboxCommon.xcframework-ios.signature already exists"; - react_native_post_install drops every package reference, so a $RNMapboxMaps.post_install that ran before it (as the docs and the Expo plugin order it) lost the package. Use React Native's spm_dependency for the rnmapbox-maps pod, add the package frameworks to the frameworks CocoaPods embeds, add a script phase that removes the duplicate xcframework signatures, and remove the product an earlier version added to the app targets. `true` selects mapbox-maps-ios with a requirement derived from $RNMapboxMapsVersion. The example Podfile enables it with RNMBX_SPM=1. * feat(expo): add the RNMapboxMapsSwiftPackageManager plugin option Writes $RNMapboxMapsSwiftPackageManager into the Podfile, either `true` or the options hash. * fix(ios): let react-native embed the Swift package frameworks when it can react/react-native#58781 makes spm_dependency embed package frameworks through install_spm_framework, defaulting to the products (MapboxMaps, a static product). Where it's supported, pass MapboxCommon, MapboxCoreMaps and Turf as embed_frameworks, and skip our framework_paths_by_config entries when the app has an embed script anyway (a framework or a dynamic xcframework), so they aren't embedded twice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
spm_dependencylinks a pod against Swift package products, but CocoaPods only embeds the frameworks of pods. Dynamic frameworks from Swift packages (binary targets like rive-ios'RiveRuntime, ortype: .dynamicproducts likeAlamofireDynamic) never reach the app bundle, so the app builds but fails at launch withdyld: Library not loaded: @rpath/RiveRuntime.framework/RiveRuntime. Separately, Xcode 26 archives fail on the duplicate signature Xcode writes for a binary target used by a pod:"RiveRuntime.xcframework-ios.signature" couldn't be copied to "Signatures" because an item with the same name already exists.This PR:
install_spm_framework <name>call per framework to the app's[CP] Embed Pods Frameworksscript, which embeds the framework from where Xcode builds it, unless it is static.embed_frameworks:tospm_dependency, defaulting toproducts, for frameworks named differently from their product (Sentry-DynamicisSentry.framework) or coming from the packages a product depends on (MapboxMapsloadsMapboxCommon,MapboxCoreMapsandTurf).*.xcframework-*.signaturefor pods not built into the shared products dir.Libraries work around this on their own today, e.g. react-native-firebase's
firebase_spm.rb, stripe/stripe-react-native#2608, maplibre/maplibre-react-native#1490, or by dropping SPM as in getsentry/sentry-react-native#6381.Changelog:
[IOS] [FIXED] -
spm_dependencyembeds the dynamic frameworks of Swift packages in the app, and takesembed_frameworksfor frameworks named differently from their productTest Plan:
ruby -Itest packages/react-native/scripts/cocoapods/__tests__/spm-test.rbpasses, with 5 new tests. It also fixes the existing tests, whose installer stub lackedaggregate_targetssince #57602.Built https://github.com/mfazekas/rn-spm-dynamic-poc (a library using
AlamofireDynamic,RiveRuntimeandSentry-Dynamic) with thisspm.rbon RN 0.84 and Xcode 26.5:Library not loaded: @rpath/RiveRuntime.framework, and the Release archive fails on the duplicate signature.RiveRuntimeandSentry;AlamofireDynamicdoes not link statically, with or without this change).Its
more-packagesbranch does the same with Agora, Mapbox, Stripe and Firebase.