Skip to content

fix(cli): Use sentry-cocoa 9.x APIs in the Apple wizard snippets - #2790

Merged
antonis merged 1 commit into
mainfrom
fix/apple-wizard-cocoa-9-templates
Dec 2, 2026
Merged

antonis merged 1 commit into
mainfrom
fix/apple-wizard-cocoa-9-templates

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Testing sentry wizard ios on fresh Xcode 16+ projects showed that the app doesn't compile after the wizard runs. Two template bugs in packages/cli/src/lib/wizard/apple/templates.ts, carried over from @sentry/wizard 9.1.0, cause it:

  1. Logs uses an option that doesn't exist in sentry-cocoa 9.x. With Logs on (the default answer), both snippets wrote options.experimental.enableLogs, which fails with:

    value of type 'SentryExperimentalOptions' has no member 'enableLogs'
    

    In 9.x Logs is a top-level option, so the snippets now write options.enableLogs = true (Swift) and options.enableLogs = YES; (Objective-C), with the comment "Enable logs to be sent to Sentry". @objc public var enableLogs is on Options from 9.0.0 through 9.36.0, and the wizard installs sentry-cocoa from 9.0.0 up to the next major, so it works on every version the wizard can install.

  2. The Objective-C snippet used the wrong profiling lifecycle name. It wrote profiling.lifecycle = SentryProfilingLifecycleTrace;, which fails on every Objective-C app with:

    use of undeclared identifier 'SentryProfilingLifecycleTrace'
    

    The 9.x name is SentryProfileLifecycleTrace, from the Swift @objc enum SentryProfileLifecycle. The Swift snippet's .trace was already correct.

via Antonis Lilis.

--

View Session [Sentry]

The Logs option is top-level in sentry-cocoa 9.x, so write
`options.enableLogs` instead of `options.experimental.enableLogs`. The
Objective-C profiling lifecycle constant is `SentryProfileLifecycleTrace`,
not `SentryProfilingLifecycleTrace`. Both broke the build of the app
right after `sentry wizard ios`.

Co-Authored-By: Antonis Lilis <antonis.lilis@sentry.io>
@vercel

vercel Bot commented Dec 2, 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 2, 2026 1:21pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 2, 2026 1:21pm UTC

Request Review

@antonis
antonis marked this pull request as ready for review December 2, 2026 13:28
@antonis
antonis enabled auto-merge December 2, 2026 13:28
@github-actions github-actions Bot added the risk: low PR risk score: low label Dec 2, 2026
@antonis
antonis added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 904377f Dec 2, 2026
32 checks passed
@antonis
antonis deleted the fix/apple-wizard-cocoa-9-templates branch December 2, 2026 13:39
@antonis

antonis commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Tested end to end with the packed npm build of a local branch: main (9116f43) plus #2790, #2791, #2792 and #2789, merged in that order (216f4fb2f). Xcode 27.2, sentry-cocoa 9.36.0. The projects are fresh Xcode 16+ "App" template projects in their pre-wizard state, against sentry-sdks/sentry-cocoa, with default answers (Logs = Yes) unless noted. Release builds.

The app now compiles as the wizard leaves it:

Project Snippet Release build Event
iOS SwiftUI options.enableLogs = true ✅ ✅ symbolicated, WizSwiftUIApp.swift:35
iOS SwiftUI, --no-logs no enableLogs line ✅ ✅
iOS UIKit (Objective-C) options.enableLogs = YES; and profiling.lifecycle = SentryProfileLifecycleTrace; ✅ ✅ symbolicated, AppDelegate.m:39
tvOS SwiftUI options.enableLogs = true ✅ (with #2791) ✅
macOS SwiftUI options.enableLogs = true ✅ ✅

Before this PR, the same projects failed with value of type 'SentryExperimentalOptions' has no member 'enableLogs' (Swift and Objective-C) and use of undeclared identifier 'SentryProfilingLifecycleTrace' (Objective-C).

antonis added a commit that referenced this pull request Dec 2, 2026
…iling-platform-check

Resolve the templates.test.ts conflict with #2790 by keeping both new
describe blocks: the profiling platform check and the 9.x API check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

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

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant