How to add Sentry to your iOS app
What Sentry does for an iOS app
Once your app is in real users' hands, you need to know when it crashes and why. Sentry collects crash reports with full stack traces, the device and OS, and the breadcrumbs leading up to the failure, then groups duplicate crashes into a single issue so you can prioritize by impact. It also tracks release health, so you can watch the crash-free rate of a new version, and performance traces for slow operations. To make crash reports readable, Sentry needs your dSYM symbol files, which you upload during the build using a Sentry auth token.
Adding Sentry with AppFlight
In AppFlight you open the integrations panel, choose Sentry, and paste your DSN. AppFlight stores the DSN as a client value, safe to ship in the app, since it can only send events to your project. If you upload dSYM files for symbolication, the Sentry auth token is treated as a secret and kept out of the binary. From there you can ask the AI to initialize Sentry at launch and capture a specific error path, and it generates the SwiftUI setup.
A SwiftUI example
Start Sentry at launch, then capture a handled error where it matters:
import Sentry
import SwiftUI
@main
struct MyApp: App {
init() {
SentrySDK.start { options in
options.dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
options.tracesSampleRate = 0.2
}
}
var body: some Scene {
WindowGroup { ContentView() }
}
}
func saveProfile() {
do {
try persistProfile()
} catch {
SentrySDK.capture(error: error)
}
}
Alternatives
Firebase Crashlytics is a free and widely used crash reporter, tied to the Google stack, but it is more focused on crashes than full error and performance tracing. Apple's own Xcode Organizer surfaces crash reports from the App Store at no cost, though it lacks alerting, grouping richness, and breadcrumbs. Sentry is the pick when you want crashes, handled errors, performance, and release health together, with strong alerting and a choice of cloud or self-hosted.
FAQ
Is the Sentry DSN a secret?
The DSN is a client identifier that is safe to ship in the app, since it can only send events to your project, not read them. It is not a password. Auth tokens for the Sentry API are the secret credentials and stay server-side, for example when uploading dSYM symbol files in CI.
Does Sentry symbolicate iOS crashes?
Yes, if you upload your dSYM files. Sentry uses them to turn raw memory addresses into readable function names and line numbers. This upload uses a Sentry auth token, which is a secret and belongs in your build pipeline, not the app.
Does Sentry do more than crashes?
Yes. Beyond crash reporting it captures handled errors, performance traces, and release health, so you can see crash-free rates per release and slow spans. You can scope what it collects in the SDK configuration.