Full Sentry SDK setup for Apple platforms (iOS, macOS, tvOS, watchOS, visionOS). Use when asked to "add Sentry to iOS", "add Sentry to Swift", "install sentry-cocoa", or configure error monitoring, tracing, profiling, session replay, or logging for Apple applications. Supports SwiftUI and UIKit.
Full Sentry SDK setup for Apple platforms (iOS, macOS, tvOS, watchOS, visionOS). Use when asked to "add Sentry to iOS", "add Sentry to Swift", "install sentry-cocoa", or configure error monitoring, tracing, profiling, session replay, or logging for Apple applications. Supports SwiftUI and UIKit.
license
Apache-2.0
Sentry Cocoa SDK
Opinionated wizard that scans your Apple project and guides you through complete Sentry setup.
Invoke This Skill When
User asks to "add Sentry to iOS/macOS/tvOS" or "set up Sentry" in an Apple app
User wants error monitoring, tracing, profiling, session replay, or logging in Swift/ObjC
User mentions sentry-cocoa, SentrySDK, or the Apple/iOS Sentry SDK
User wants to monitor crashes, app hangs, watchdog terminations, or performance
Note: SDK versions and APIs below reflect Sentry docs at time of writing (sentry-cocoa 9.5.1).
Always verify against docs.sentry.io/platforms/apple/ before implementing.
Phase 1: Detect
Run these commands to understand the project before making any recommendations:
✅ Tracing — always for apps; auto-instruments app launch, network, UIViewController, file I/O, Core Data
✅ Profiling — production apps; continuous profiling with minimal overhead
Optional (enhanced observability):
⚡ Session Replay — user-facing apps; ⚠️ disabled by default on iOS 26+ (Liquid Glass rendering)
⚡ Logging — when structured log capture is needed
⚡ User Feedback — apps that want crash/error feedback forms from users
Not available for Cocoa:
❌ Metrics — use custom spans instead
❌ Crons — backend only
❌ AI Monitoring — JS/Python only
Recommendation logic:
Feature
Recommend when...
Error Monitoring
Always — non-negotiable baseline
Tracing
Always for apps — rich auto-instrumentation out of the box
Profiling
Production apps where performance matters
Session Replay
iOS only user-facing apps (check iOS 26+ caveat; not tvOS/macOS/watchOS/visionOS)
Logging
Existing os.log / CocoaLumberjack usage, or structured logs needed
User Feedback
Apps wanting in-app bug reports with screenshots
Propose: "I recommend Error Monitoring + Tracing + Profiling. Want me to also add Session Replay and Logging?"
Phase 3: Guide
Install
Option 1 — Sentry Wizard (recommended): Walks you through login, org/project selection, and auth token setup interactively. Then installs the SDK, updates AppDelegate, adds dSYM/debug symbol upload build phases, and configures everything automatically.
Hosts/regex that receive distributed trace headers
enableCaptureFailedRequests
Bool
true
Auto-capture HTTP 5xx errors as events
enableNetworkBreadcrumbs
Bool
true
Breadcrumbs for outgoing HTTP requests
inAppInclude
[String]
[]
Module prefixes treated as "in-app" code
maxBreadcrumbs
Int
100
Max breadcrumbs per event
sampleRate
Float
1.0
Error event sample rate
beforeSend
Closure
nil
Hook to mutate/drop error events
onCrashedLastRun
Closure
nil
Called on next launch after a crash
Environment Variables
Variable
Maps to
Purpose
SENTRY_DSN
dsn
Data Source Name
SENTRY_RELEASE
releaseName
App version (e.g., my-app@1.0.0)
SENTRY_ENVIRONMENT
environment
Deployment environment
Platform Feature Support Matrix
Feature
iOS
tvOS
macOS
watchOS
visionOS
Crash Reporting
✅
✅
✅
✅
✅
App Hangs V2
✅
✅
❌
❌
❌
Watchdog Termination
✅
✅
❌
❌
❌
App Start Tracing
✅
✅
❌
❌
✅
UIViewController Tracing
✅
✅
❌
❌
✅
SwiftUI Tracing
✅
✅
✅
❌
✅
Network Tracking
✅
✅
✅
❌
✅
Profiling
✅
✅
✅
❌
✅
Session Replay
✅
❌
❌
❌
❌
MetricKit
✅ (15+)
❌
✅ (12+)
❌
❌
Verification
Test that Sentry is receiving events:
// Trigger a test error event:SentrySDK.capture(message: "Sentry Cocoa SDK test")
// Or test crash reporting (without debugger — crashes are intercepted by debugger):// SentrySDK.crash() // uncomment, run without debugger, relaunch to see crash report
Check the Sentry dashboard within a few seconds. If nothing appears:
Set options.debug = true — prints SDK internals to Xcode console
Verify the DSN is correct and the project exists
Ensure initialization is on the main thread
Production Settings
Lower sample rates for production to control volume and cost:
options.tracesSampleRate =0.2// 20% of transactions
options.configureProfiling = {
$0.sessionSampleRate =0.1// 10% of sessions$0.lifecycle = .trace
}
options.sessionReplay.sessionSampleRate =0.1// 10% continuous
options.sessionReplay.onErrorSampleRate =1.0// 100% on error (keep high)
options.debug =false// never in production
Phase 4: Cross-Link
After completing Apple setup, check for a companion backend missing Sentry coverage:
# Detect companion backendls ../backend ../server ../api 2>/dev/null
cat ../go.mod 2>/dev/null | head -5
cat ../requirements.txt ../Pipfile 2>/dev/null | head -5
cat ../Gemfile 2>/dev/null | head -5
cat ../package.json 2>/dev/null | grep -E '"name"|"dependencies"' | head -5
If a backend is found, configure tracePropagationTargets to enable distributed tracing end-to-end, and suggest the matching skill:
Backend detected
Suggest skill
Trace header support
Go (go.mod)
sentry-go-sdk
✅ automatic
Python (requirements.txt)
sentry-python-sdk
✅ automatic
Ruby (Gemfile)
sentry-ruby-sdk
✅ automatic
Node.js backend (package.json)
sentry-node-sdk (or sentry-express-sdk)
✅ automatic
Troubleshooting
Issue
Solution
Events not appearing
Set debug: true, verify DSN format, ensure init is on main thread
Crashes not captured
Run without debugger attached — debugger intercepts signals
App hangs not reported
Auto-disabled when debugger attached; check appHangTimeoutInterval
Session Replay not recording
Check iOS version — disabled by default on iOS 26+ (Liquid Glass); verify sessionSampleRate > 0