Skip to content

feat(ios): opt-in consumption of sentry-cocoa via Swift Package Manager#6182

Merged
alwx merged 4 commits into
mainfrom
alwx/feat/spm-sentry-cocoa
May 27, 2026
Merged

feat(ios): opt-in consumption of sentry-cocoa via Swift Package Manager#6182
alwx merged 4 commits into
mainfrom
alwx/feat/spm-sentry-cocoa

Conversation

@alwx
Copy link
Copy Markdown
Contributor

@alwx alwx commented May 18, 2026

Adds a new opt-in path in RNSentry.podspec: when SENTRY_USE_SPM=1 is set in the environment before pod install, RNSentry pulls Sentry from the sentry-cocoa SPM package (as a binary xcframework) instead of from the Sentry CocoaPods source build.

This is the first step of the broader SPM migration tracked at #5780. It unblocks experimentation with binary-framework consumption of sentry-cocoa while keeping CocoaPods as the production default.

BUT those things need to be done before we will be able to migrate:

  1. The Sentry xcframework in sentry-cocoa 9.13.0 and earlier is missing the SentrySessionReplayHybridSDK symbol due to a packaging bug (fix(replay): correct file type for SentrySessionReplayHybridSDK.m in pbxproj sentry-cocoa#7911). Apps that use Session Replay will fail to link until that fix ships in a sentry-cocoa release. Apps not using Session Replay are unaffected.
  2. SentrySwizzle.h must be imported via framework-style (<Sentry/...>) rather than quote-style when the xcframework is the consumption path — already handled by #6181

Verified locally:

  • Default pod install (no env var) — ** BUILD SUCCEEDED ** on the RN sample, identical to the pre-change state.
  • SENTRY_USE_SPM=1 pod install — Sentry no longer in Podfile.lock, XCRemoteSwiftPackageReference "sentry-cocoa" injected into the Xcode project, [SPM] log lines confirm the helper ran correctly.

Refs: #5780, #6170

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

@alwx alwx self-assigned this May 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • feat(ios): opt-in consumption of sentry-cocoa via Swift Package Manager by alwx in #6182
  • chore(deps): bump getsentry/craft from 2.26.5 to 2.26.6 by dependabot in #6213
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.5 to 2.26.6 by dependabot in #6214
  • chore(deps): bump github/codeql-action from 4.35.5 to 4.36.0 by dependabot in #6215
  • fix(ios): Return NO from requiresMainQueueSetup by antonis in #6202
  • fix(tracing): Bound TTID/TTFD to prevent inflated transactions by antonis in #6210
  • feat(core): Add disableAutoUpload option to Expo plugin by antonis in #6195
  • chore(deps): Remove unused @sentry/types dependency by antonis in #6207
  • Correct route and dynamic param extraction for Expo Router (Correct route and dynamic param extraction for Expo Router #6157) by alwx in #6197
  • chore(deps): update CLI to v3.4.3 by github-actions in #6205
  • chore(deps): update Cocoa SDK to v9.14.0 by github-actions in #6204
  • chore(deps): update Maestro to v2.6.0 by github-actions in #6198
  • chore(deps): bump js-cookie from 3.0.5 to 3.0.7 by dependabot in #6203
  • chore(deps): bump @tootallnate/once from 2.0.0 to 2.0.1 by dependabot in #6206
  • chore(deps): update Sentry Android Gradle Plugin to v6.8.1 by github-actions in #6196
  • feat(core): Expose pauseAppHangTracking and resumeAppHangTracking APIs by antonis in #6192

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 70f3b52

Comment thread packages/core/RNSentry.podspec Outdated
@alwx alwx changed the title WIP: feat(ios): opt-in consumption of sentry-cocoa via Swift Package Manager feat(ios): opt-in consumption of sentry-cocoa via Swift Package Manager May 26, 2026
@alwx alwx marked this pull request as ready for review May 26, 2026 08:44
Adds a new opt-in path in RNSentry.podspec: when `SENTRY_USE_SPM=1` is set
in the environment before `pod install`, RNSentry pulls `Sentry` from the
sentry-cocoa SPM package (as a binary xcframework) instead of from the
Sentry CocoaPods source build.

Default behavior is unchanged. Existing users on any React Native version
keep their current CocoaPods-based consumption with no action required.

The opt-in path requires React Native >= 0.75 because it uses the
`SPMManager` singleton defined in `react-native/scripts/cocoapods/spm.rb`,
which is loaded transitively from the Podfile via `react_native_pods.rb`.

This is the first step of the broader SPM migration tracked at #5780. It
unblocks experimentation with binary-framework consumption of sentry-cocoa
while keeping CocoaPods as the production default.

Two known caveats for users opting in today:

1. The Sentry xcframework in sentry-cocoa 9.13.0 and earlier is missing the
   `SentrySessionReplayHybridSDK` symbol due to a packaging bug
   (getsentry/sentry-cocoa#7911). Apps that use Session Replay will fail to
   link until that fix ships in a sentry-cocoa release. Apps not using
   Session Replay are unaffected.
2. `SentrySwizzle.h` must be imported via framework-style (`<Sentry/...>`)
   rather than quote-style when the xcframework is the consumption path —
   already handled by #6175 (in this same release).

Verified locally:
- Default `pod install` (no env var) — `** BUILD SUCCEEDED **` on the
  RN sample, identical to the pre-change state.
- `SENTRY_USE_SPM=1 pod install` — Sentry no longer in Podfile.lock,
  `XCRemoteSwiftPackageReference "sentry-cocoa"` injected into the Xcode
  project, [SPM] log lines confirm the helper ran correctly.

Refs: #5780, #6170
@alwx alwx force-pushed the alwx/feat/spm-sentry-cocoa branch from 404d962 to 58a4f9d Compare May 26, 2026 08:47
@alwx
Copy link
Copy Markdown
Contributor Author

alwx commented May 26, 2026

since we've updated sentry-cocoa to the latest version, this can be finalized now

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 15f788d. Configure here.

Comment thread packages/core/RNSentry.podspec
@antonis antonis added the ready-to-merge Triggers the full CI test suite label May 26, 2026
@sentry
Copy link
Copy Markdown

sentry Bot commented May 26, 2026

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.12.0 (89) Release

⚙️ sentry-react-native Build Distribution Settings

Copy link
Copy Markdown
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

LGTM but let's wait for GitHub to get back to normal to verify that the CI is 🟢

@github-actions
Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3828.66 ms 1218.85 ms -2609.81 ms
Size 5.15 MiB 6.69 MiB 1.53 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5569641+dirty 3839.22 ms 1231.30 ms -2607.91 ms
7ac3378+dirty 1213.37 ms 1218.15 ms 4.78 ms
9210ae6+dirty 3815.93 ms 1214.14 ms -2601.79 ms
a3265b6+dirty 3826.31 ms 1207.87 ms -2618.44 ms
4953e94+dirty 1212.06 ms 1214.83 ms 2.77 ms
d2eadf8+dirty 3842.42 ms 1228.91 ms -2613.50 ms
4e0ba9c+dirty 3839.22 ms 1221.06 ms -2618.16 ms
ef27341+dirty 3856.13 ms 1231.42 ms -2624.71 ms
c151573+dirty 3841.06 ms 1232.13 ms -2608.93 ms
5748023+dirty 3840.49 ms 1227.43 ms -2613.05 ms

App size

Revision Plain With Sentry Diff
5569641+dirty 5.15 MiB 6.67 MiB 1.51 MiB
7ac3378+dirty 3.38 MiB 4.76 MiB 1.38 MiB
9210ae6+dirty 5.15 MiB 6.68 MiB 1.53 MiB
a3265b6+dirty 5.15 MiB 6.68 MiB 1.53 MiB
4953e94+dirty 3.38 MiB 4.73 MiB 1.35 MiB
d2eadf8+dirty 5.15 MiB 6.67 MiB 1.51 MiB
4e0ba9c+dirty 5.15 MiB 6.67 MiB 1.51 MiB
ef27341+dirty 5.15 MiB 6.68 MiB 1.53 MiB
c151573+dirty 5.15 MiB 6.68 MiB 1.53 MiB
5748023+dirty 5.15 MiB 6.68 MiB 1.53 MiB

@github-actions
Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3843.62 ms 1220.53 ms -2623.09 ms
Size 5.15 MiB 6.69 MiB 1.53 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5569641+dirty 3824.35 ms 1210.78 ms -2613.57 ms
7ac3378+dirty 1202.35 ms 1198.31 ms -4.04 ms
9210ae6+dirty 3834.11 ms 1216.64 ms -2617.47 ms
a3265b6+dirty 3844.26 ms 1235.60 ms -2608.66 ms
4953e94+dirty 1217.41 ms 1223.53 ms 6.12 ms
d2eadf8+dirty 3841.53 ms 1216.15 ms -2625.39 ms
4e0ba9c+dirty 3856.39 ms 1234.44 ms -2621.95 ms
ef27341+dirty 3835.20 ms 1212.23 ms -2622.97 ms
c151573+dirty 3835.64 ms 1216.10 ms -2619.53 ms
5748023+dirty 3844.74 ms 1225.49 ms -2619.26 ms

App size

Revision Plain With Sentry Diff
5569641+dirty 5.15 MiB 6.67 MiB 1.51 MiB
7ac3378+dirty 3.38 MiB 4.76 MiB 1.38 MiB
9210ae6+dirty 5.15 MiB 6.68 MiB 1.53 MiB
a3265b6+dirty 5.15 MiB 6.68 MiB 1.53 MiB
4953e94+dirty 3.38 MiB 4.73 MiB 1.35 MiB
d2eadf8+dirty 5.15 MiB 6.67 MiB 1.51 MiB
4e0ba9c+dirty 5.15 MiB 6.67 MiB 1.51 MiB
ef27341+dirty 5.15 MiB 6.68 MiB 1.53 MiB
c151573+dirty 5.15 MiB 6.68 MiB 1.53 MiB
5748023+dirty 5.15 MiB 6.68 MiB 1.53 MiB

Copy link
Copy Markdown
Collaborator

@lucas-zimerman lucas-zimerman left a comment

Choose a reason for hiding this comment

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

LGTM!

@alwx alwx merged commit 853723c into main May 27, 2026
85 checks passed
@alwx alwx deleted the alwx/feat/spm-sentry-cocoa branch May 27, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants