getsentry/sentry-for-aiApache-2.08 files

Sentry Cocoa SDK

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, logging, or metrics for Apple applications. Supports SwiftUI and UIKit.

Specification
Skill ID
getsentry/sentry-for-ai/sentry-cocoa-sdk
Publisher
getsentry
Repository
sentry-for-ai
Installs
0
Files
8
License
Apache-2.0
Synced
Sep 23, 2026
How to use it

Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.

getsentry/sentry-for-ai/sentry-cocoa-sdkInstalls these files
  • SKILL.md
  • references/error-monitoring.md
  • references/logging.md
  • references/metrics.md
  • references/profiling.md
  • references/session-replay.md
  • references/tracing.md
  • references/user-feedback.md

What this skill tells the agent

All Skills > SDK Setup > Cocoa SDK

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, or metrics in Swift
  • 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.15.0). Always verify against docs.sentry.io/platforms/apple/ before implementing.

Phase 1: Detect

Run these commands to understand the project before making any recommendations:

# Check existing Sentry dependency
grep -rEi "sentry|sentry-cocoa|SentrySPM|SentrySwiftUI" \
  --include="Package.swift" --include="Podfile" --include="Cartfile" \
  --include="Package.resolved" --include="project.pbxproj" . 2>/dev/null | head -20

# Detect UI framework (SwiftUI vs UIKit)
grep -rE "@main|struct .*: App" --include="*.swift" . 2>/dev/null | head -5
grep -rE "AppDelegate|UIApplicationMain|@UIApplicationDelegateAdaptor" --include="*.swift" . 2>/dev/null | head -5

# Detect platform and deployment targets
grep -rE "platforms:|\\.iOS|\\.macOS|\\.tvOS|\\.watchOS|\\.visionOS|IPHONEOS_DEPLOYMENT_TARGET|MACOSX_DEPLOYMENT_TARGET|TVOS_DEPLOYMENT_TARGET|WATCHOS_DEPLOYMENT_TARGET|XROS_DEPLOYMENT_TARGET" \
  --include="Package.swift" --include="project.pbxproj" . 2>/dev/null | head -20
grep -E "platform :ios|platform :osx|platform :tvos|platform :watchos" Podfile 2>/dev/null

# Detect logging
grep -rE "import OSLog|import os\\.log|Logger\\(|CocoaLumberjack|DDLog" --include="*.swift" . 2>/dev/null | head -5

# Detect companion backend
ls ../backend ../server ../api 2>/dev/null
ls ../go.mod ../requirements.txt ../Gemfile ../package.json 2>/dev/null

What to note:

  • Is sentry-cocoa already in Package.swift or Podfile? If yes, skip to Phase 2 (configure features).
  • SwiftUI (@main App struct) or UIKit (AppDelegate)? Determines init pattern.
  • Which Apple platforms? (Affects which features are available — see Platform Support Matrix.)
  • Existing logging library? (Enables structured log capture.)
  • SwiftUI tracing import/product? SentrySwiftUI still exists but is deprecated in SDK 9.4.1+; prefer the main Sentry module for released binary products.
  • Companion backend? (Triggers Phase 4 cross-link for distributed tracing.)

Phase 2: Recommend

Based on what you found, present a concrete recommendation. Don't ask open-ended questions — lead with a proposal:

Recommended (core coverage):

  • Error Monitoring — always; crash reporting, app hangs, watchdog terminations, NSError/Swift errors
  • Tracing — always for apps; auto-instruments app launch, network, UIViewController, file I/O, Core Data
  • Profiling — production iOS/macOS apps; UI profiling via configureProfiling

Optional (enhanced observability):

  • Session Replay — user-facing iOS apps; verify masking on iOS 26+ / Liquid Glass builds
  • Logging — when structured log capture is needed
  • Metrics — Swift apps needing aggregate counters, gauges, or distributions
  • User Feedback — apps that want crash/error feedback forms from users

Not available for Cocoa:

  • Crons — backend only
  • AI Monitoring — JS/Python only

Recommendation logic:

FeatureRecommend when...
Error MonitoringAlways — non-negotiable baseline
TracingAlways for apps — rich auto-instrumentation out of the box
ProfilingiOS/macOS production apps where performance matters (not tvOS/watchOS/visionOS)
Session ReplayUser-facing iOS apps; tvOS may work but is not officially supported
LoggingExisting os.log / CocoaLumberjack usage, or structured logs needed
MetricsAggregate product or health signals that should not create issues; Swift only, SDK 9.12+
User FeedbackApps 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):

You need to run this yourself — the wizard opens a browser for login and requires interactive input that the agent can't handle. Copy-paste into your terminal: `` brew install getsentry/tools/sentry-wizard && sentry-wizard -i ios `` It handles login, org/project selection, auth token setup, SDK installation, AppDelegate updates, and dSYM/debug symbol upload build phases. Once it finishes, come back and skip to [Verification](#verification).

If the user skips the wizard, proceed with Option 2 (SPM/CocoaPods) and manual setup below.

Option 2 — Swift Package Manager: File → Add Packages → enter:

https://github.com/getsentry/sentry-cocoa.git

Or in Package.swift:

.package(url: "https://github.com/getsentry/sentry-cocoa", from: "9.15.0"),

SPM Products — choose exactly one per target:

ProductUse Case
SentryRecommended — static framework, fast app start; includes SwiftUI APIs in SDK 9.4.1+
Sentry-DynamicDynamic framework alternative
SentrySwiftUILegacy/deprecated re-export for SwiftUI APIs; use only when maintaining older setup
Sentry-WithoutUIKitOrAppKitwatchOS, app extensions, CLI tools (Swift < 6.1)
SentrySPM + NoUIFramework traitSource build without UIKit/AppKit for CLI/headless targets (SDK 9.7+ / Swift 6.1+ / Xcode 26.4+ for Xcode UI)
Warning: Xcode allows selecting multiple products — choose only one. If using SentrySPM from source, current source-build projects may import SentrySwift instead of Sentry; verify the module name in the target. Released binary products use import Sentry.

Swift 6.1+ trait-based opt-out of UIKit/AppKit (requires Package@swift-6.1.swift manifest):

// Package.swift (Swift 6.1+)
.package(
    url: "https://github.com/getsentry/sentry-cocoa",
    from: "9.15.0",
    traits: ["NoUIFramework"]
),

// In your target's dependencies:
.product(name: "SentrySPM", package: "sentry-cocoa")

This is the preferred opt-out path for command-line/headless targets on Swift 6.1+. It compiles the SDK from source so the trait can remove UIKit/AppKit/SwiftUI linkage. For Swift < 6.1 continue using Sentry-WithoutUIKitOrAppKit.

Note: Package traits are visible in the Xcode UI starting with Xcode 26.4+. On older Xcode versions, traits still work when declared in Package.swift but won't appear in the GUI.

Option 3 — CocoaPods (deprecated; prefer SPM):

platform :ios, '15.0'
use_frameworks!

target 'YourApp' do
  pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '9.15.0'
end

Sentry plans to stop publishing CocoaPods releases at the end of June 2026; use this only for existing CocoaPods projects.

Known issue (Xcode 14+): Sandbox rsync.samba error → Target Settings → "Enable User Script Sandbox" → NO.

Option 4 — SentryObjC (for pure Objective-C/C++ projects):

For pure Objective-C or Objective-C++ projects that cannot enable Clang modules (e.g., -fmodules=NO), use the SentryObjC wrapper SDK. It provides the same functionality as the main SDK but with pure Objective-C headers that don't require Swift module imports.

SPM:

.package(url: "https://github.com/getsentry/sentry-cocoa", from: "9.17.1"),

// In your target's dependencies:
.product(name: "SentryObjC", package: "sentry-cocoa")

Use this skill in a project

Open any RiverX project, search the Skills panel for getsentry/sentry-for-ai/sentry-cocoa-sdk, and install it in one click.

Use this skill