Repository navigation
feat(cli): Ask about Session Replay in the Apple wizard - #2830
Conversation
The iOS wizard asked about Tracing, Logs, and Profiling but never set up Session Replay. Ask it after Profiling, whatever the Tracing answer, and write sessionSampleRate 0.1 and onErrorSampleRate 1.0 to the snippet. sentry-cocoa 9.x defines options.sessionReplay only on iOS, tvOS, and visionOS, so the lines sit inside a platform check; macOS apps would not compile otherwise. Co-Authored-By: Antonis Lilis <antonis.lilis@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
antonis
left a comment
There was a problem hiding this comment.
Let's drop visionOS from the Replay guard. sentry-cocoa only added sessionReplay on visionOS in 9.28.0 (9.27.0's guard is (os(iOS) || os(tvOS))), so a visionOS project whose sentry-cocoa is already resolved below 9.28.0 wouldn't compile the snippet. visionOS is rare, and Replay there is new, so it's not worth that risk.
- Swift:
#if os(iOS) || os(tvOS)instead of#if os(iOS) || os(tvOS) || os(visionOS). - Objective-C:
#if TARGET_OS_IOS || TARGET_OS_TVinstead of#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION. - Update the code comment to say visionOS is left out on purpose and why (Replay needs sentry-cocoa 9.28.0 there), and update the tests that check the guard.
- Update the PR body: visionOS apps get no Replay from the wizard, and the "projects pinned below 9.28.0 fail to compile" note no longer applies.
Leave the profiling guard from #2791 as it is.
sentry-cocoa defines options.sessionReplay on visionOS only since 9.28.0, and the wizard accepts any 9.x, so a visionOS project resolved below that wouldn't compile the snippet. Compile Replay in on iOS and tvOS only. Co-Authored-By: Antonis Lilis <antonis.lilis@sentry.io>
|
@antonis Done in ed410236f. The Replay guard is now The tests that check the guard now expect the new lines. The |
sentry wizard iosasks about Tracing, Logs, and Profiling, but never sets up Session Replay. This adds a Replay question after Profiling (--replay/--no-replay). It is asked whatever the Tracing answer is, because Replay doesn't need tracing. The answer is recorded in theenable-session-replaytag (the same tag the React Native wizard uses).With Replay on, the snippet sets
options.sessionReplay.sessionSampleRate = 0.1andoptions.sessionReplay.onErrorSampleRate = 1.0. These lines go after the profiling block.Platform check
The Replay lines are wrapped the same way as the profiling block from #2791:
#if os(iOS) || os(tvOS)#if TARGET_OS_IOS || TARGET_OS_TVsentry-cocoa 9.x defines
sessionReplayonly on iOS and tvOS, plus visionOS starting in 9.28.0. Without a guard, macOS apps wouldn't compile.visionOS apps get no Replay from the wizard. It's left out on purpose: Replay on visionOS needs sentry-cocoa 9.28.0, and the wizard accepts any 9.x. With visionOS excluded, every visionOS project compiles the snippet, whatever sentry-cocoa version it resolved.
The Objective-C check also leaves out the
SENTRY_OBJC_HAS_UIKIThalf of the guard inSentryObjCOptions.h. Only the SentryObjC headers define that macro. Under the snippet's@import Sentryit would read as 0 and compile Replay out everywhere.SENTRY_NO_UI_FRAMEWORKis internal to sentry-cocoa, and the wizard adds theSentryproduct, which includes the UI framework.Open
via Antonis Lilis.
--
View Session [Sentry]