Skip to content

Migrate from PrivateSentrySDKOnly to [SentryObjCSDK internal] #6370

Closed

Description

@philprime

sentry-cocoa 9.19.0 introduces a new structured hybrid SDK API via SentryObjCSDK.internal (ObjC). The old PrivateSentrySDKOnly class is deprecated and will be removed in the next major version.

Implementation PR: getsentry/sentry-cocoa#8097
Design doc: SENTRY-INTERNAL-API.md

Benefits

  • No more internal header imports. Drop PrivateSentrySDKOnly.h, SentrySwizzle.h, and any private header search path. The new API is fully public.
  • Structured, discoverable API. Methods are grouped by feature area (.replay, .profiling, .performance, etc.).
  • SPM / xcframework compatible. Works with binary distribution — no exposed private headers.
  • capture returns BOOL. No more performSelector: workaround on getReplayIntegration.

Import Change

Since React Native's iOS code is Objective-C (.m / .mm), migrate to the SentryObjC target:

// Before
#import <Sentry/PrivateSentrySDKOnly.h>
#import <Sentry/SentrySwizzle.h>

// After — single import, no private headers
#import <SentryObjC/SentryObjC.h>
// Access via [SentryObjCSDK internal].*

Affected Files (as of latest main)

  • packages/core/ios/RNSentry.mm — largest call site (~30 usages)
  • packages/core/ios/RNSentryStart.m — SDK init, name/version/package setup
  • packages/core/ios/RNSentryReplay.mm — replay container classes
  • packages/core/ios/RNSentryReplayBreadcrumbConverterHelper.m — replay breadcrumb config
  • packages/core/ios/RNSentryRNSScreen.m — SentrySwizzle.h macro usage
  • packages/core/ios/SentrySDKWrapper.m — options.debug, options.releaseName
  • packages/core/ios/SentryScreenFramesWrapper.m — currentScreenFrames
  • packages/core/ios/RNSentrySDK.m — optionsWithDictionary:didFailWithError:

Full migration table

See the detailed migration guide for complete before/after for every method.

Key changes:

  • [PrivateSentrySDKOnly setSdkName:name andVersionString:version] → [[[SentryObjCSDK internal] sdk] setName:name version:version]
  • [PrivateSentrySDKOnly captureReplay] (void) → [[[SentryObjCSDK internal] replay] capture] (returns BOOL)
  • SentrySwizzleInstanceMethod macro → [[[SentryObjCSDK internal] swizzle] swizzleInstanceMethod:inClass:newImpFactory:mode:key:]
  • [PrivateSentrySDKOnly envelopeWithData:] → [[[SentryObjCSDK internal] envelope] deserializeFrom:]
  • [PrivateSentrySDKOnly optionsWithDictionary:didFailWithError:] → [[SentryObjCSDK internal] optionsFromDictionary:error:]

Checklist

  • Replace all PrivateSentrySDKOnly call sites with [SentryObjCSDK internal].*
  • Remove SentrySwizzle.h import and macro usage in RNSentryRNSScreen.m
  • Change imports from #import <Sentry/PrivateSentrySDKOnly.h> to #import <SentryObjC/SentryObjC.h>
  • Remove private header search paths from Podspec / build settings
  • Remove performSelector: workaround for replay capture
  • Bump minimum sentry-cocoa dependency to 9.19.0+
  • Run full test suite

Activity

  1. linear-code commented on Jun 29, 2026

    @linear-code
  2. self-assigned this
    on Jun 30, 2026
  3. added 6 commits that reference this issue on Jul 2, 2026
    e1c292c
    4cab06e
    1185b2c
    f0f4bdf
    76f1e44
    a3f38d4
  4. added a commit that references this issue on Jul 14, 2026
    eae9020
  5. github-actions commented on Jul 16, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #6380, which was included in the 8.19.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions