Understanding Crash Logs: A Guide for iOS Developers
In this article
Crash logs are the most direct evidence of why an iOS app terminated unexpectedly. They contain the sequence of function calls (the stack trace), the exception type, and the state of the app at the moment of failure. To use them, you need the log file, the matching dSYM file (for symbolication), and Xcode or a similar tool to read them. This guide walks through obtaining, reading, and acting on crash logs so you can turn a cryptic report into a fix.
What You'll Need
- Xcode installed on a Mac (for symbolication and the Devices and Simulators window).
- The crash log file (.crash or .ips) from a device, the App Store, or a crash-reporting service.
- The dSYM file generated when the app was built. Without it, system frames may symbolicate but your app's frames will show as hexadecimal addresses.
- Access to the exact build that crashed (same version and build number).
Step-by-Step
- Obtain the crash log. On a test device, connect it to your Mac, open Xcode, go to Window > Devices and Simulators, select the device, and click View Device Logs. For App Store crashes, use the Crashes organizer in Xcode (Window > Organizer > Crashes) or your crash-reporting service's dashboard. For ad-hoc builds, retrieve the .ips file from the device's Analytics Data (Settings > Privacy & Security > Analytics & Improvements > Analytics Data) and share it.
- Confirm the build matches. Open the crash log and check the bundle version and build number in the header. If they differ from the dSYM you have, symbolication will fail. Download or locate the correct dSYM from your build archive (Xcode Organizer > Archives) or your CI system.
- Symbolicate the log. In Xcode, open the Devices and Simulators window, select View Device Logs, and drag the .ips file into the list. Xcode will attempt to symbolicate using dSYMs stored in its cache. If you have the dSYM separately, place it in the same folder as the crash log and use the
symbolicatecrashcommand-line tool (found inside Xcode's package) or a third-party symbolication service. The goal is to replace memory addresses with function names and line numbers. - Read the header. The top of the log shows the exception type (e.g., EXC_BAD_ACCESS, EXC_CRASH, EXC_BREAKPOINT), the termination reason (e.g., SIGABRT, SIGSEGV), and the faulting thread. This tells you the category of problem: a memory access violation, an uncaught exception, or a watchdog timeout.
- Locate the crashed thread and the top frames. Scroll to the thread marked as crashed. The first few frames (0, 1, 2...) are where the failure occurred. Frame 0 is the exact function that triggered the crash. Look for your app's module name in those frames—that is where you start investigating.
- Check the exception codes and messages. For EXC_BAD_ACCESS, look at the sub-type (e.g., KERN_INVALID_ADDRESS) and the address. A low address often indicates a nil or dangling pointer. For EXC_CRASH with SIGABRT, look for an "Application Specific Information" section that may contain an uncaught exception name and reason (e.g., NSInvalidArgumentException).
- Correlate with your code. Use the symbolicated function names and line numbers to open the relevant source file. If the crash is in a system framework, look at the frame just below it that belongs to your app—that is usually the caller you control. Common culprits: force-unwrapping nil optionals, array index out of bounds, or calling UIKit APIs off the main thread.
- Reproduce and verify. Once you have a hypothesis, try to reproduce the crash on a simulator or device by following the same user path. Add breakpoints or logging around the suspect code. After fixing, run the app through the same scenario and confirm the crash no longer occurs. Keep the original log for comparison.
- Automate collection for the future. Integrate a crash-reporting SDK (e.g., Firebase Crashlytics, Sentry) that uploads symbolicated logs automatically. Ensure your build process uploads dSYMs to the service so reports are readable without manual steps.
Common Mistakes
- Using the wrong dSYM. A single build number mismatch renders the entire log unsymbolicated. Always verify the UUID of the dSYM matches the crash log's binary image UUID.
- Ignoring the exception type. Jumping straight to the stack trace without reading the exception type can send you down the wrong path. EXC_BAD_ACCESS and SIGABRT have very different root causes.
- Assuming the top frame is your bug. If frame 0 is in a system library, the bug is likely in your code that called it. Look at the first frame from your app's module.
- Not keeping dSYMs. dSYMs are not stored in the app binary; they must be archived. Losing them makes historical crashes unsymbolicable.
- Overlooking memory warnings. Some crashes are actually jetsam (low-memory) terminations, which appear differently in logs—often with no stack trace for your app. Check the termination reason for "per-process-limit" or "memory pressure".
Tips
- Enable "Upload Your dSYMs" in Xcode's build settings or your CI pipeline to ensure they are archived with each build.
- Use the "Open Quickly" feature in Xcode (Cmd+Shift+O) to jump to a symbolicated function by name.
- For intermittent crashes, add lightweight logging around suspect areas and use TestFlight to gather logs from external testers.
- When reading a log, start from the bottom of the crashed thread's stack and work upward—the lower frames show the call chain that led to the failure.
- Keep a shared folder or artifact repository for dSYMs, organized by version and build number.
Troubleshooting
If symbolication fails, first confirm the dSYM UUID matches the crash log's binary image UUID. You can find the UUID in the crash log under "Binary Images" and in the dSYM using the dwarfdump --uuid command. If they differ, you have the wrong dSYM. If Xcode's automatic symbolication does not work, try the symbolicatecrash script manually: locate it in Xcode's package (Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash), set the DEVELOPER_DIR environment variable, and run it with the crash log and dSYM. If the log is from a TestFlight build, ensure you have downloaded the dSYMs from App Store Connect. For crashes that only occur on device, check for architecture mismatches (arm64 vs. arm64e) and ensure your dSYM covers the correct architecture.
Frequently Asked Questions
What is a dSYM file and why do I need it?
A dSYM (debug symbol) file maps memory addresses in a crash log to function names and line numbers. Without it, you see only hexadecimal addresses, making debugging nearly impossible.
Can I symbolicate a crash log without the original build?
No. Symbolication requires the exact dSYM generated for that build. If you don't have it, you can only see system framework symbols, not your app's code.
What does EXC_BAD_ACCESS mean?
It indicates a memory access violation, such as dereferencing a nil or deallocated object. Check the sub-type and address for clues; often it's a force-unwrapped optional or a dangling pointer.
How do I get crash logs from a user's device?
Ask the user to go to Settings > Privacy & Security > Analytics & Improvements > Analytics Data, find the log for your app, and share it. Alternatively, use a crash-reporting SDK that collects logs automatically.
Why does my crash log show only addresses?
The log is unsymbolicated. This happens when the dSYM is missing or mismatched. Verify the build number and UUID, then symbolicate with the correct dSYM.
What is a watchdog timeout crash?
It occurs when the app takes too long to respond (e.g., blocking the main thread). The log shows a termination reason like 0x8badf00d. Look for long-running operations on the main thread.