Reading a crash report
A crash report is like the black box of a plane. It tells you:
- Which app version and device: the header. A crash only on one OS version, or only on old devices, is already a clue.
- What kind of crash: the exception type. Different types mean very different problems (see the table below).
- Where: the backtrace of the crashed thread. Read it from the top: the first frames from your code are usually the most interesting.
You’ll see reports in Xcode → Window → Organizer → Crashes (from users who share diagnostics with developers) and in crash reporting services like Crashlytics or Sentry, which collect more of them and group them.
For function names and line numbers, the report needs the dSYMdSYMA file with the debug symbols of one exact build, used to turn crash report addresses into function names and line numbers.Open in glossary → of exactly that build: a file Xcode creates when it archives the app, which maps memory addresses back to your code. This is called symbolication. Without it you only see addresses like 0x0000000102a4c3f8.
The report’s header (version, build, OS, device model, launch time vs crash time) narrows the population; the exception type and codes plus termination reason classify the failure; the crashed thread’s backtrace locates it; the other threads and the binary images section (load addresses and UUIDs) explain context and allow manual symbolication (atos -arch arm64 -o App.dSYM/Contents/Resources/DWARF/App -l <load address> <address>). Symbolication requires the dSYM whose UUID matches the binary; upload dSYMs from CI for every archive (Crashlytics, Sentry), since bitcode and App Store recompilation no longer apply. Release builds inline aggressively, so the top frame of yours may be a caller of the real culprit, and line numbers can point near, not at, the failing check. In .ips JSON (iOS 15+) the same fields are machine-readable. Note what a crash report can’t show: terminations by the system (jetsam, some watchdog kills, background task expirations) appear only as termination reasons in MetricKit and the Organizer’s Terminations report, not as crashes.
// CheckoutViewModel.swift:48
var total: Decimal {
items.reduce(0) { $0 + prices[$1.productID]! * Decimal($1.quantity) } // a price missing from the dictionary
}Incident Identifier: 6F1A…
Hardware Model: iPhone14,5
Version: 4.12 (1287)
OS Version: iPhone OS 18.3.1 (22D72)
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001a2b5e8f4
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libswiftCore.dylib _assertionFailure(_:_:file:line:flags:) + 244
1 Shop CheckoutViewModel.total.getter + 312 (CheckoutViewModel.swift:48)
2 Shop CheckoutView.body.getter + 1020 (CheckoutView.swift:31)
3 SwiftUICore …Reading it:
EXC_BREAKPOINT (SIGTRAP)with_assertionFailureat the top means a Swift safety check failed on purpose: here, a force unwrap (!) foundnil.- Frame 1 is the first line of your app’s code:
CheckoutViewModel.swift:48. - Thread 0, the main thread, crashed while SwiftUI was drawing the checkout screen.
The fix is not to replace ! with ?? 0 and move on: a missing price would make the total wrong. Ask why a product in the cart has no price (stale cache? product removed from the catalog?) and handle that case on purpose.
| Exception type | Usually means | First things to check |
|---|---|---|
EXC_BREAKPOINT (SIGTRAP) | A Swift runtime trap: force unwrap of nil, index out of range, integer overflow, fatalError, failed precondition | The first frame in your code; the line is the failed check |
EXC_BAD_ACCESS (SIGSEGV / SIGBUS) | Reading or writing invalid memory | Data races, unowned references to freed objects, unsafe pointers, C/Objective-C code |
EXC_CRASH (SIGABRT) | Something called abort(): often an uncaught Objective-C exception | “Last Exception Backtrace”: e.g. NSInvalidArgumentException, invalid UITableView updates |
0x8badf00d termination | Watchdog: the app didn’t respond in time (launch, resume, background tasks) | Synchronous work on the main thread at launch or when returning from background |
| No crash report, app “just closes” | Memory limit (jetsamJetsamThe iOS mechanism that terminates apps using too much memory, without producing a crash report.Open in glossary →) or another system termination | MetricKit exit reasons, Organizer → Terminations, Allocations |
Tap the line with the bug.
// Crash report: EXC_BREAKPOINT in OrderHistoryView.body, "Index out of range"
struct OrderHistoryView: View {
let orders: [Order]
let selectedIndex: Int
var body: some View {
if selectedIndex < orders.count {
OrderDetail(order: orders[selectedIndex])
} else {
EmptyView()
}
}
}Hint: The crash is gone. Is the user's problem gone too?
The bounds check stops the crash, but the user who tapped an order now sees a blank screen, and the team loses the signal that something is wrong. The real bug is upstream: the view stores an index into a list that can change (a refresh removed an order, or the list was re-sorted) while the selection still points at the old position.
Select by a stable id instead of a position, and handle “this order no longer exists” explicitly:
struct OrderHistoryView: View {
let orders: [Order]
let selectedID: Order.ID
var body: some View {
if let order = orders.first(where: { $0.id == selectedID }) {
OrderDetail(order: order)
} else {
ContentUnavailableView("Order not found", systemImage: "bag")
}
}
}Practice: from report to fix
- Group: in the Organizer or your crash reporter, open the top crash. Note how many users, which versions, which OS versions. If it started in one version, compare that version’s changes.
- Classify: read the exception type with the table above.
EXC_BREAKPOINTpoints to a Swift check;EXC_BAD_ACCESSto memory or threads. - Locate: find the first frame from your app in the crashed thread. Open that file and line.
- Ask why: which value was unexpected (
nil, an index, a state)? Where does it come from? Find the path that produces it. - Reproduce if you can: a unit test with that state is the best proof of the fix.
- Fix the cause, then watch: after release, check that the crash group stops growing for the new version.
Predict the output
A crash report shows EXC_CRASH (SIGABRT). The "Last Exception Backtrace" contains -[UITableView _endCellAnimationsWithContext:] and the reason says "Invalid update: invalid number of rows in section 0". What happened?
UIKit checks that numberOfRowsInSection after a batch update equals the count before plus inserts minus deletes. If the data array was changed differently (or on another thread, or twice), UIKit throws an Objective-C exception, which ends in abort(): SIGABRT. Diffable data sources avoid this whole class of crash, because you apply snapshots instead of counting rows by hand.
What the top frame doesn’t tell you
- Optimized frames: inlining can make the crash appear in a caller, and tail calls can remove frames entirely. Check the line numbers of neighbouring frames and, if needed, the disassembly in Xcode with the dSYM.
- Crashes in system frameworks are almost always caused by how you called them: look for the first frame of yours, on any thread, and for main-thread-only APIs called elsewhere.
- Memory corruption shows up far from its cause: the crash in
Dictionaryis where a race was noticed, not where the second writer was. TreatEXC_BAD_ACCESSwithKERN_INVALID_ADDRESSnear small addresses asnil-ish dereferences in unsafe or Objective-C code, and random-looking addresses as corruption. - Duplicates: grouping by top frame merges different bugs and splits one bug across OS versions. Read several reports in a group before concluding.
- Report: header (version, OS, device), exception type/codes, termination reason, crashed thread backtrace, binary images (UUIDs, load addresses for
atos). - Symbolication needs the matching dSYM: upload from CI for every archive.
EXC_BREAKPOINT: Swift traps (unwrap, bounds, overflow,fatalError).EXC_BAD_ACCESS: invalid memory (races,unowned, unsafe/ObjC).SIGABRT: uncaught ObjC exception (Last Exception Backtrace).0x8badf00d: watchdog.- Jetsam and other system terminations produce no crash report: MetricKit exit reasons, Organizer Terminations.
- Release inlining moves frames; corruption crashes far from the cause; fix causes, not symptoms.
Check this part
A crash report shows only addresses, no function names. What’s missing?
EXC_BREAKPOINT with _assertionFailure at the top usually means…
Users say the app closes, but there are no crash reports. Likely cause?
What does termination code 0x8badf00d mean?