Skip to content

feat(cli): Ask about Session Replay in the Apple wizard - #2830

Merged
antonis merged 2 commits into
mainfrom
feat/apple-wizard-session-replay
Dec 3, 2026
Merged

antonis merged 2 commits into
mainfrom
feat/apple-wizard-session-replay

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

sentry wizard ios asks 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 the enable-session-replay tag (the same tag the React Native wizard uses).

With Replay on, the snippet sets options.sessionReplay.sessionSampleRate = 0.1 and options.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:

  • Swift: #if os(iOS) || os(tvOS)
  • Objective-C: #if TARGET_OS_IOS || TARGET_OS_TV

sentry-cocoa 9.x defines sessionReplay only 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_UIKIT half of the guard in SentryObjCOptions.h. Only the SentryObjC headers define that macro. Under the snippet's @import Sentry it would read as 0 and compile Replay out everywhere. SENTRY_NO_UI_FRAMEWORK is internal to sentry-cocoa, and the wizard adds the Sentry product, which includes the UI framework.

Open

  • This stays a draft on purpose. Don't mark it ready.
  • It hasn't been built in a real macOS app yet.

via Antonis Lilis.

--

View Session [Sentry]

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>
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Dec 3, 2026 10:06am UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 3, 2026 10:06am UTC

Request Review

@antonis antonis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_TV instead 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>
@sentry-junior

sentry-junior Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

@antonis Done in ed410236f. The Replay guard is now #if os(iOS) || os(tvOS) in Swift and #if TARGET_OS_IOS || TARGET_OS_TV in Objective-C. The code comments say visionOS is left out because Replay there needs sentry-cocoa 9.28.0, and the wizard accepts any 9.x.

The tests that check the guard now expect the new lines. The --no-tracing --replay wizard test also checks that the snippet has no visionOS. The PR body now says visionOS apps get no Replay from the wizard, and the pinned-below-9.28.0 note is gone. The profiling guard from #2791 is unchanged.

@antonis
antonis marked this pull request as ready for review December 3, 2026 10:28
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 3, 2026
@antonis
antonis added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 708e10b Dec 3, 2026
33 checks passed
@antonis
antonis deleted the feat/apple-wizard-session-replay branch December 3, 2026 10:33

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — ed410236 Deployed Dec 3, 2026 by vercel[bot]
Preview – sentry-local — ed410236 Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant