fix(react-native): Add use_modular_headers! to iOS Podfile for Swift RNSentry pod#1311
Merged
Merged
Conversation
…t RNSentry pod
As of @sentry/react-native 8.19.0 the RNSentry pod ships Swift code (the
RNSentryInternal bridge over SentrySDK.internal, part of the migration to the
prebuilt Sentry.xcframework). CocoaPods refuses to integrate a Swift pod that
depends on a non-modular Objective-C pod (e.g. React-hermes) unless the Podfile
opts into module maps, so `pod install` fails with:
[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod `RNSentry` depends upon `React-hermes`, which does not define
modules. [...] you may set `use_modular_headers!` globally in your Podfile
The wizard now patches the iOS Podfile with `use_modular_headers!` before
running `pod install`, matching what the SDK docs instruct users to do manually.
Re-enables the react-native e2e test on macOS (was skipped in #1303).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
antonis
marked this pull request as ready for review
July 23, 2026 15:27
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
Re-enables the React Native e2e test on macOS (skipped in #1303) by fixing the underlying
pod installfailure.Root cause: As of
@sentry/react-native8.19.0, theRNSentrypod ships Swift code (theRNSentryInternalbridge overSentrySDK.internal, part of the migration to the prebuiltSentry.xcframework— see sentry-react-native #6413 / #6495). CocoaPods refuses to integrate a Swift pod that depends on a non-modular Objective-C pod (e.g.React-hermeson RN versions that don't modularize it by default) unless the Podfile opts into module maps. Sopod installfails with:The error was masked in CI because
pod install --silentonly surfaces curl progress, not the CocoaPods error (which is why #1305's--verboserepro was on the right track). This affected real RN users too — the SDK CHANGELOG instructs them to adduse_modular_headers!by hand — so the wizard now does it for them.Changes
src/react-native/cocoapod.ts: new idempotentaddModularHeaders()that insertsuse_modular_headers!above the firsttargetblock inios/Podfile(no-op if already present, ignores commented-out targets, logged transparently).src/react-native/react-native-wizard.ts: patch the Podfile beforepod installwhenever the project uses CocoaPods, so the wizard's install and any later manualpod installboth work.e2e-tests/tests/react-native.test.ts: removedescribe.skipIf(darwin)and assert the Podfile getsuse_modular_headers!. Fixture Podfile stays vanilla so the test exercises the wizard adding it.test/react-native/cocoapod.test.ts: 7 new unit tests foraddModularHeaders.CHANGELOG.md: entry under Unreleased.Testing
pod installfailure with@sentry/react-native8.19.0 on the RN 0.78 test app (exit 1); confirmeduse_modular_headers!fixes it (exit 0).Pods installed.succeeds.test/react-native/unit tests: 140/140.yarn buildandyarn lintclean.🤖 Generated with Claude Code