Manual Setup
Learn how to set up the SDK manually.
If you can't (or prefer not to) run the automatic setup, you can follow the instructions below to configure your application manually.
The minimum required version for iOS is 11.0.
We recommend installing the SDK with CocoaPods, but we also support alternate installation methods. To integrate Sentry into your Xcode project, specify it in your Podfile
:
Podfile
Copied
platform :ios, '11.0'
use_frameworks! # This is important
target 'YourApp' do
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '8.41.0'
end
Then run pod install
.
We recommend initializing the SDK on the main thread as soon as possible – in your AppDelegate application:didFinishLaunchingWithOptions
method, for example:
Copied
import Sentry // Make sure you import Sentry
// ....
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
SentrySDK.start { options in
options.dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
options.debug = true // Enabled debug when first installing is always helpful
}
return true
}
If you're using SwiftUI and your app doesn't implement an app delegate, initialize the SDK within the App conformer's initializer:
Copied
import Sentry
@main
struct SwiftUIApp: App {
init() {
SentrySDK.start { options in
options.dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
options.debug = true // Enabled debug when first installing is always helpful
// Enable tracing to capture 100% of transactions for tracing.
// Use 'options.tracesSampleRate' to set the sampling rate.
// We recommend setting a sample rate in production.
options.enableTracing = true
}
}
}
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").