sentry-cocoa 9.19.0 introduces a new structured hybrid SDK API via SentrySDK.internal (Swift) and 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
- Structured, discoverable API. Methods are grouped by feature area instead of one flat class.
- Deprecation-clean builds.
PrivateSentrySDKOnly has deprecation annotations — migrating eliminates warnings.
- SPM / xcframework compatible. Works with binary distribution — no exposed private headers.
Current Usage
The .NET SDK uses Xamarin/MAUI bindings to PrivateSentrySDKOnly via ApiDefinitions.cs. The binding interface exposes the full PrivateSentrySDKOnly API surface and a patching script (patch-cocoa-bindings.cs) modifies the generated bindings.
The migration involves:
- Generating new bindings against the
SentryObjCInternalApi headers instead of PrivateSentrySDKOnly.h
- Updating the C# wrapper code that calls the bindings
- Updating
patch-cocoa-bindings.cs for the new API shape
Key Changes
The new ObjC API uses instance methods on [SentryObjCSDK internal] instead of static methods on PrivateSentrySDKOnly.
SDK Metadata
| Before (binding) |
After (binding) |
[Static] SetSdkName(string, string) |
[SentryObjCSDK internal].sdk → SetName:version: |
[Static] string SdkName { get; } |
[SentryObjCSDK internal].sdk.name |
[Static] string SdkVersionString { get; } |
[SentryObjCSDK internal].sdk.versionString |
[Static] NSDictionary ExtraContext { get; } |
[SentryObjCSDK internal].sdk.extraContext |
[Static] string InstallationID { get; } |
[SentryObjCSDK internal].sdk.installationID |
Profiling
| Before (binding) |
After (binding) |
[Static] StartProfilerForTrace(SentryId) |
[[[SentryObjCSDK internal] profiling] startForTrace:] |
[Static] CollectProfileBetween(ulong, ulong, SentryId) |
[[[SentryObjCSDK internal] profiling] collectBetween:and:forTrace:] |
[Static] DiscardProfilerForTrace(SentryId) |
[[[SentryObjCSDK internal] profiling] discardForTrace:] |
Performance & Frames
| Before (binding) |
After (binding) |
[Static] bool FramesTrackingMeasurementHybridSDKMode { get; set; } |
[SentryObjCSDK internal].performance.framesTrackingHybridSDKMode |
[Static] bool IsFramesTrackingRunning { get; } |
[SentryObjCSDK internal].performance.isFramesTrackingRunning |
[Static] SentryScreenFrames CurrentScreenFrames { get; } |
[SentryObjCSDK internal].performance.currentScreenFrames |
Screenshot & View Hierarchy
| Before (binding) |
After (binding) |
[Static] NSData[] CaptureScreenshots() |
[[[SentryObjCSDK internal] screenshot] capture] |
[Static] NSData CaptureViewHierarchy() |
[[[SentryObjCSDK internal] viewHierarchy] capture] |
Replay
| Before (binding) |
After (binding) |
[Static] ConfigureSessionReplayWith(converter, provider) |
[[[SentryObjCSDK internal] replay] configureBreadcrumbConverter:screenshotProvider:] |
[Static] CaptureReplay() (void) |
[[[SentryObjCSDK internal] replay] capture] → returns BOOL |
[Static] string ReplayId { get; } |
[SentryObjCSDK internal].replay.replayId |
Breadcrumbs & Users
| Before (binding) |
After (binding) |
[Static] UserWithDictionary(NSDictionary) |
[[[SentryObjCSDK internal] user] fromDictionary:] |
[Static] BreadcrumbWithDictionary(NSDictionary) |
[[[SentryObjCSDK internal] breadcrumbs] fromDictionary:] |
Affected Files (as of latest main)
src/Sentry.Bindings.Cocoa/ApiDefinitions.cs — PrivateSentrySDKOnly binding interface
scripts/patch-cocoa-bindings.cs — binding patching script referencing PrivateSentrySDKOnly methods
Checklist
sentry-cocoa9.19.0 introduces a new structured hybrid SDK API viaSentrySDK.internal(Swift) andSentryObjCSDK.internal(ObjC). The oldPrivateSentrySDKOnlyclass is deprecated and will be removed in the next major version.Implementation PR: getsentry/sentry-cocoa#8097
Design doc: SENTRY-INTERNAL-API.md
Benefits
PrivateSentrySDKOnlyhas deprecation annotations — migrating eliminates warnings.Current Usage
The .NET SDK uses Xamarin/MAUI bindings to
PrivateSentrySDKOnlyviaApiDefinitions.cs. The binding interface exposes the fullPrivateSentrySDKOnlyAPI surface and a patching script (patch-cocoa-bindings.cs) modifies the generated bindings.The migration involves:
SentryObjCInternalApiheaders instead ofPrivateSentrySDKOnly.hpatch-cocoa-bindings.csfor the new API shapeKey Changes
The new ObjC API uses instance methods on
[SentryObjCSDK internal]instead of static methods onPrivateSentrySDKOnly.SDK Metadata
[Static] SetSdkName(string, string)[SentryObjCSDK internal].sdk→SetName:version:[Static] string SdkName { get; }[SentryObjCSDK internal].sdk.name[Static] string SdkVersionString { get; }[SentryObjCSDK internal].sdk.versionString[Static] NSDictionary ExtraContext { get; }[SentryObjCSDK internal].sdk.extraContext[Static] string InstallationID { get; }[SentryObjCSDK internal].sdk.installationIDProfiling
[Static] StartProfilerForTrace(SentryId)[[[SentryObjCSDK internal] profiling] startForTrace:][Static] CollectProfileBetween(ulong, ulong, SentryId)[[[SentryObjCSDK internal] profiling] collectBetween:and:forTrace:][Static] DiscardProfilerForTrace(SentryId)[[[SentryObjCSDK internal] profiling] discardForTrace:]Performance & Frames
[Static] bool FramesTrackingMeasurementHybridSDKMode { get; set; }[SentryObjCSDK internal].performance.framesTrackingHybridSDKMode[Static] bool IsFramesTrackingRunning { get; }[SentryObjCSDK internal].performance.isFramesTrackingRunning[Static] SentryScreenFrames CurrentScreenFrames { get; }[SentryObjCSDK internal].performance.currentScreenFramesScreenshot & View Hierarchy
[Static] NSData[] CaptureScreenshots()[[[SentryObjCSDK internal] screenshot] capture][Static] NSData CaptureViewHierarchy()[[[SentryObjCSDK internal] viewHierarchy] capture]Replay
[Static] ConfigureSessionReplayWith(converter, provider)[[[SentryObjCSDK internal] replay] configureBreadcrumbConverter:screenshotProvider:][Static] CaptureReplay()(void)[[[SentryObjCSDK internal] replay] capture]→ returnsBOOL[Static] string ReplayId { get; }[SentryObjCSDK internal].replay.replayIdBreadcrumbs & Users
[Static] UserWithDictionary(NSDictionary)[[[SentryObjCSDK internal] user] fromDictionary:][Static] BreadcrumbWithDictionary(NSDictionary)[[[SentryObjCSDK internal] breadcrumbs] fromDictionary:]Affected Files (as of latest
main)src/Sentry.Bindings.Cocoa/ApiDefinitions.cs—PrivateSentrySDKOnlybinding interfacescripts/patch-cocoa-bindings.cs— binding patching script referencingPrivateSentrySDKOnlymethodsChecklist
SentryObjCInternalApiheadersPrivateSentrySDKOnlyinterface inApiDefinitions.cswithSentryObjCInternalApi+ sub-object interfacespatch-cocoa-bindings.csfor new API shape+class methods, new API uses instance methods on[SentryObjCSDK internal])sentry-cocoadependency to9.19.0+