Skip to content

fix(react-native): Add use_modular_headers! to iOS Podfile for Swift RNSentry pod#1311

Merged
antonis merged 1 commit into
masterfrom
fix/rn-pod-install-modular-headers
Jul 24, 2026
Merged

fix(react-native): Add use_modular_headers! to iOS Podfile for Swift RNSentry pod#1311
antonis merged 1 commit into
masterfrom
fix/rn-pod-install-modular-headers

Conversation

@antonis

@antonis antonis commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Re-enables the React Native e2e test on macOS (skipped in #1303) by fixing the underlying pod install failure.

Root cause: 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 — 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-hermes on RN versions that don't modularize it by default) 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 error was masked in CI because pod install --silent only surfaces curl progress, not the CocoaPods error (which is why #1305's --verbose repro was on the right track). This affected real RN users too — the SDK CHANGELOG instructs them to add use_modular_headers! by hand — so the wizard now does it for them.

Changes

  • src/react-native/cocoapod.ts: new idempotent addModularHeaders() that inserts use_modular_headers! above the first target block in ios/Podfile (no-op if already present, ignores commented-out targets, logged transparently).
  • src/react-native/react-native-wizard.ts: patch the Podfile before pod install whenever the project uses CocoaPods, so the wizard's install and any later manual pod install both work.
  • e2e-tests/tests/react-native.test.ts: remove describe.skipIf(darwin) and assert the Podfile gets use_modular_headers!. Fixture Podfile stays vanilla so the test exercises the wizard adding it.
  • test/react-native/cocoapod.test.ts: 7 new unit tests for addModularHeaders.
  • CHANGELOG.md: entry under Unreleased.

Testing

  • Reproduced the exact pod install failure with @sentry/react-native 8.19.0 on the RN 0.78 test app (exit 1); confirmed use_modular_headers! fixes it (exit 0).
  • Full RN e2e test passes on macOS (11/11) — the wizard logs adding the line, then Pods installed. succeeds.
  • test/react-native/ unit tests: 140/140. yarn build and yarn lint clean.

🤖 Generated with Claude Code

…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
antonis marked this pull request as ready for review July 23, 2026 15:27
@antonis
antonis requested review from alwx and msonnb July 23, 2026 15:27

@msonnb msonnb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thank you!

@antonis
antonis merged commit 3aaa362 into master Jul 24, 2026
110 checks passed
@antonis
antonis deleted the fix/rn-pod-install-modular-headers branch July 24, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants