Skip to content

refactor(ios): Migrate from PrivateSentrySDKOnly to SentrySDK.internal#6380

Draft
alwx wants to merge 2 commits into
mainfrom
alwx/refactor/migrate-private-sentry-sdk-only
Draft

refactor(ios): Migrate from PrivateSentrySDKOnly to SentrySDK.internal#6380
alwx wants to merge 2 commits into
mainfrom
alwx/refactor/migrate-private-sentry-sdk-only

Conversation

@alwx

@alwx alwx commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Refactoring

📜 Description

Replace deprecated PrivateSentrySDKOnly SPI and SentrySwizzle.h macro usage in our iOS code with the new SentrySDK.internal Swift API exposed by sentry-cocoa 9.19.0, via a thin in-pod ObjC↔Swift bridge (RNSentryInternal.swift).

The bridge uses @_spi(Private) import Sentry to reach SPI-gated sub-APIs (performance.currentScreenFrames, replay.configure, envelope.{store,capture,deserialize}). Existing .m/.mm callers route through [RNSentryInternal …] via the auto-generated RNSentry-Swift.h. The performSelector:@selector(getReplayIntegration) workaround in captureReplayWithReturnValue is gone — SentrySDK.internal.replay.capture() returns Bool directly.

Notably, we do not use sentry-cocoa's new SentryObjC umbrella module (which the issue suggested) — that module isn't shipped via the Sentry CocoaPod in 9.19.0, only via SPM as a separate xcframework. The Swift bridge works equally on both consumption paths.

💡 Motivation and Context

Closes #6370. PrivateSentrySDKOnly is deprecated in sentry-cocoa 9.19.0 and slated for removal in the next major. Migrating now avoids future churn and drops the private header search path / performSelector: reliance.

💚 How did you test it?

  • yarn build, yarn test, yarn lint, yarn circularDepCheck — all green
  • xcodebuild for the RNSentry pod target (iphonesimulator) — builds clean
  • xcodebuild test for RNSentryCocoaTester — 158/158 native Cocoa tests pass

📝 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

Replace the deprecated PrivateSentrySDKOnly SPI and SentrySwizzle.h macro
with the new SentrySDK.internal Swift API exposed by sentry-cocoa 9.19.0,
via a thin in-pod ObjC<->Swift bridge (RNSentryInternal.swift). Imports
Sentry with @_spi(Private) for SPI-gated sub-APIs (performance, replay,
envelope). Drops the performSelector workaround around getReplayIntegration
since SentrySDK.internal.replay.capture() returns Bool directly.

Closes #6370

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

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).


  • refactor(ios): Migrate from PrivateSentrySDKOnly to SentrySDK.internal by alwx in #6380
  • fix(replay): Forward Session Replay network detail options to native SDKs by antonis in #6373
  • fix(ci): Pin Android E2E emulator to build 15679343 (37.1.5.0) by antonis in #6378
  • feat(core): Expose top-level Sentry.setAttribute / setAttributes by antonis in #6354
  • docs: Add AI Use section to CONTRIBUTING.md by christophaigner in #6374
  • feat(replay): Default networkCaptureBodies to true by alwx in #6372
  • chore(deps): bump getsentry/craft from 2.26.10 to 2.26.13 by dependabot in #6368
  • chore(deps): bump getsentry/github-workflows/danger from 17cc15eb58ea3687cd8f2714a4192dcee4aa09ef to 4013fc6e1aeb1be1f9d3b4d232624f0ec1afa613 by dependabot in #6366
  • chore(deps): bump getsentry/github-workflows/validate-pr from 71588ddf95134f804e82c5970a8098588e2eaecd to 4013fc6e1aeb1be1f9d3b4d232624f0ec1afa613 by dependabot in #6364
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.10 to 2.26.13 by dependabot in #6367
  • feat(core): Wire TurboModulePerfLogger on iOS and Android by alwx in #6307
  • chore(deps): bump actions/cache from 4 to 6 by dependabot in #6365
  • chore(deps): update CLI to v3.6.0 by github-actions in #6362
  • chore(deps): bump faraday from 1.10.5 to 1.10.6 in /samples/react-native by dependabot in #6363
  • chore(deps): update JavaScript SDK to v10.62.0 by github-actions in #6361
  • Expo Router ErrorBoundary auto wrapped by alwx in #6347
  • chore(ci): Move sample app iOS build jobs to GitHub Actions runners by itaybre in #6356
  • docs: Add missing 8.14.1 to changelog and SDK versions table by antonis in #6360
  • chore(deps): update Android SDK to v8.46.0 by github-actions in #6357
  • chore(ci): Move testflight and size-analysis iOS jobs to GitHub Actions macos-26 by itaybre in #6355
  • feat(core): Use native btoa for envelope base64 encoding by alwx in #6351
  • release: 8.16.0 by antonis in 7c15464b
  • chore(e2e): Bump concurrent-ruby to 1.3.7 in samples and perf-tests by antonis in #6331
  • fix(replay): Guard against non-dictionary touch breadcrumb path elements by antonis in #6346

Plus 23 more


🤖 This preview updates automatically when you update the PR.

Move RNSentryStartTests, RNSentryStartFromFileTests, and RNSentryReplayOptionsTests
to SentrySDK.internal.{options, options(fromDictionary:), appStart.hybridSDKMode,
performance.framesTrackingHybridSDKMode}.

The ObjC RNSentryTests.m keeps PrivateSentrySDKOnly for now — the test target
is a separate consumer of the RNSentry static-lib pod and cannot see
RNSentry-Swift.h without modulemap surgery. Worth revisiting when sentry-cocoa
removes PrivateSentrySDKOnly in the next major.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

Migrate from PrivateSentrySDKOnly to [SentryObjCSDK internal]

1 participant