For the Profiling integration to work, you must have the Sentry Cocoa package (minimum version 8.12.0). We offer installation methods for Carthage (shown below), CocoaPods, and Swift Package Manager. Learn more about installation methods in our full documentation.
\ngithub \"getsentry/sentry-cocoa\" \"8.19.0\"For the Profiling integration to work, you must have the Sentry Cocoa package (minimum version 8.12.0). We offer installation methods for Carthage (shown below) and Swift Package Manager. CocoaPods is deprecated and will not receive updates after June 2026. Learn more about installation methods in our full documentation.
\ngithub \"getsentry/sentry-cocoa\" \"8.19.0\"We recommend installing the SDK with Swift Package Manager (SPM), but we also support alternate installation methods. To integrate Sentry into your Xcode
https://github.com/getsentry/sentry-cocoa.gitAlternatively, when your project uses a Package.swift file to manage dependencies, you can specify the target with:
.package(url: \"https://github.com/getsentry/sentry-cocoa\", from: \"8.19.0\"),Make sure you initialize the SDK as soon as possible in your application lifecycle e.g. in your AppDelegate application:didFinishLaunchingWithOptions method:
import Sentry\n\n// ....\n\nfunc application(_ application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n\n SentrySDK.start { options in\n options.dsn = \"___PUBLIC_DSN___\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n }\n\n return true\n}When using SwiftUI and your app doesn't implement an app delegate, initialize the SDK within the App conformer's initializer:
\nimport Sentry\n\n@main\nstruct SwiftUIApp: App {\n init() {\n SentrySDK.start { options in\n options.dsn = \"___PUBLIC_DSN___\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n }\n }\n}This snippet contains an intentional error you can use to test that errors are uploaded to Sentry correctly. You can add it to your main ViewController.
let button = UIButton(type: .roundedRect)\nbutton.frame = CGRect(x: 20, y: 50, width: 100, height: 30)\nbutton.setTitle(\"Break the world\", for: [])\nbutton.addTarget(self, action: #selector(self.breakTheWorld(_:)), for: .touchUpInside)\nview.addSubview(button)\n\n@IBAction func breakTheWorld(_ sender: AnyObject) {\n fatalError(\"Break the world\")\n}\n\nWant to play with some new features? Try out our experimental features for View Hierarchy, Time to Full Display (TTFD), MetricKit, Prewarmed App Start Tracing, and Swift Async Stacktraces. Experimental features are still a work-in-progress and may have bugs. We recognize the irony.
\nLet us know if you have feedback through GitHub issues.
\n
import Sentry\n\nSentrySDK.start { options in\n // ...\n\n // Enable all experimental features\n options.attachViewHierarchy = true\n options.enablePreWarmedAppStartTracing = true\n options.enableMetricKit = true\n options.enableTimeToFullDisplayTracing = true\n options.swiftAsyncStacktraces = true\n}We recommend installing the SDK with Swift Package Manager (SPM), but we also support alternate installation methods. To integrate Sentry into your Xcode
https://github.com/getsentry/sentry-cocoa.gitAlternatively, when your project uses a Package.swift file to manage dependencies, you can specify the target with:
.package(url: \"https://github.com/getsentry/sentry-cocoa\", from: \"8.19.0\"),Make sure you initialize the SDK as soon as possible in your application lifecycle e.g. in your AppDelegate application:didFinishLaunchingWithOptions method:
import Sentry\n\n// ....\n\nfunc application(_ application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n\n SentrySDK.start { options in\n options.dsn = \"___PUBLIC_DSN___\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n }\n\n return true\n}When using SwiftUI and your app doesn't implement an app delegate, initialize the SDK within the App conformer's initializer:
\nimport Sentry\n\n@main\nstruct SwiftUIApp: App {\n init() {\n SentrySDK.start { options in\n options.dsn = \"___PUBLIC_DSN___\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n }\n }\n}This snippet contains an intentional error you can use to test that errors are uploaded to Sentry correctly. You can add it to your main ViewController.
let button = UIButton(type: .roundedRect)\nbutton.frame = CGRect(x: 20, y: 50, width: 100, height: 30)\nbutton.setTitle(\"Break the world\", for: [])\nbutton.addTarget(self, action: #selector(self.breakTheWorld(_:)), for: .touchUpInside)\nview.addSubview(button)\n\n@IBAction func breakTheWorld(_ sender: AnyObject) {\n fatalError(\"Break the world\")\n}\n\nWant to play with some new features? Try out our experimental features for View Hierarchy, Time to Full Display (TTFD), MetricKit, Prewarmed App Start Tracing, and Swift Async Stacktraces. Experimental features are still a work-in-progress and may have bugs. We recognize the irony.
\nLet us know if you have feedback through GitHub issues.
\n
import Sentry\n\nSentrySDK.start { options in\n // ...\n\n // Enable all experimental features\n options.attachViewHierarchy = true\n options.enablePreWarmedAppStartTracing = true\n options.enableMetricKit = true\n options.enableTimeToFullDisplayTracing = true\n options.swiftAsyncStacktraces = true\n}We support installing the SDK with CocoaPods, Swift Package Manager, and Carthage.
\nTo integrate Sentry into your Xcode
Podfile:\nplatform :ios, '11.0'\nuse_frameworks! # This is important\n\ntarget 'YourApp' do\n pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '8.19.0'\nendAfterwards run pod install. For more information visit the docs.
To integrate Sentry into your Xcode
https://github.com/getsentry/sentry-cocoa.gitAlternatively, when your project uses a Package.swift file to manage dependencies, you can specify the target with:
.package(url: \"https://github.com/getsentry/sentry-cocoa\", from: \"8.19.0\"),For more information visit the docs.
\nTo integrate Sentry into your Xcode
Cartfile:\ngithub \"getsentry/sentry-cocoa\" \"8.19.0\"Run carthage update to download the framework and drag the built Sentry.framework into your Xcode project. For more information visit the docs.
Make sure you initialize the SDK as soon as possible in your application lifecycle e.g. in your AppDelegate application:didFinishLaunchingWithOptions method:
import Sentry\n\n// ....\n\nfunc application(_ application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n\n SentrySDK.start { options in\n options.dsn = \"___PUBLIC_DSN___\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n }\n\n return true\n}When using SwiftUI and your app doesn't implement an app delegate, initialize the SDK within the App conformer's initializer:
\nimport Sentry\n\n@main\nstruct SwiftUIApp: App {\n init() {\n SentrySDK.start { options in\n options.dsn = \"___PUBLIC_DSN___\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n }\n }\n}To capture crashes, you need to provide debug information to Sentry. You can also use our source context feature to display code snippets next to the event stack traces by enabling the include-sources option when uploading your debug information files. Debug information is provided by uploading dSYM files.
You can measure the performance of your code by capturing transactions and spans.
\nimport Sentry // Make sure you import Sentry\n\n// Transaction can be started by providing, at minimum, the name and the operation\nlet transaction = SentrySDK.startTransaction(name: \"Update Repos\", operation: \"db\")\n// Transactions can have child spans (and those spans can have child spans as well)\nlet span = transaction.startChild(operation: \"db\", description: \"Update first repo\")\n\n// ...\n// (Perform the operation represented by the span/transaction)\n// ...\n\nspan.finish() // Mark the span as finished\ntransaction.finish() // Mark the transaction as finished and send it to SentryCheck out the documentation to learn more about the API and automatic instrumentations.
"} +{"key":"apple.macos","type":"language","doc_link":"https://docs.sentry.io/platforms/apple/","name":"macOS","aliases":[],"categories":["desktop"],"body":"We recommend Swift Package Manager. We also support Carthage. CocoaPods is deprecated and will not receive updates after June 2026.
\nTo integrate Sentry into your Xcode
Podfile:\nplatform :ios, '11.0'\nuse_frameworks! # This is important\n\ntarget 'YourApp' do\n pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '8.19.0'\nendAfterwards run pod install. For more information visit the docs.
To integrate Sentry into your Xcode
https://github.com/getsentry/sentry-cocoa.gitAlternatively, when your project uses a Package.swift file to manage dependencies, you can specify the target with:
.package(url: \"https://github.com/getsentry/sentry-cocoa\", from: \"8.19.0\"),For more information visit the docs.
\nTo integrate Sentry into your Xcode
Cartfile:\ngithub \"getsentry/sentry-cocoa\" \"8.19.0\"Run carthage update to download the framework and drag the built Sentry.framework into your Xcode project. For more information visit the docs.
Make sure you initialize the SDK as soon as possible in your application lifecycle e.g. in your AppDelegate application:didFinishLaunchingWithOptions method:
import Sentry\n\n// ....\n\nfunc application(_ application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n\n SentrySDK.start { options in\n options.dsn = \"___PUBLIC_DSN___\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n }\n\n return true\n}When using SwiftUI and your app doesn't implement an app delegate, initialize the SDK within the App conformer's initializer:
\nimport Sentry\n\n@main\nstruct SwiftUIApp: App {\n init() {\n SentrySDK.start { options in\n options.dsn = \"___PUBLIC_DSN___\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n }\n }\n}To capture crashes, you need to provide debug information to Sentry. You can also use our source context feature to display code snippets next to the event stack traces by enabling the include-sources option when uploading your debug information files. Debug information is provided by uploading dSYM files.
You can measure the performance of your code by capturing transactions and spans.
\nimport Sentry // Make sure you import Sentry\n\n// Transaction can be started by providing, at minimum, the name and the operation\nlet transaction = SentrySDK.startTransaction(name: \"Update Repos\", operation: \"db\")\n// Transactions can have child spans (and those spans can have child spans as well)\nlet span = transaction.startChild(operation: \"db\", description: \"Update first repo\")\n\n// ...\n// (Perform the operation represented by the span/transaction)\n// ...\n\nspan.finish() // Mark the span as finished\ntransaction.finish() // Mark the transaction as finished and send it to SentryCheck out the documentation to learn more about the API and automatic instrumentations.
"}