Cause a Test Crash

Added the Crashlytics Kit and want to test it out? Cause a test crash using this line of code:

[CrashlyticsKit crash];
Crashlytics.sharedInstance().crash()

Cause a Test Exception

Exceptions are actually not quite the same as crashes. They include additional information, and are presented slightly differently in our dashboard. If you want to test out throwing an exception, then use the following code:

[CrashlyticsKit throwException];
Crashlytics.sharedInstance().throwException()

Keep Xcode’s debugger disconnected and after causing the crash, relaunch your app. Crashes are sent after it’s been launched following a crash, so be sure to place this line outside your App Delegate’s didFinishLaunching method. Keep in mind that exceptions are not guaranteed to cause a crash.

Pro-tip: Call that code on a button push.

Crashes are processed in real-time, but we group crashes to help you focus on the most important issues. If the crash is for an existing issue, we will add it to that issue so that you can dive into the details. New crash? A new issue will be created.

Fun fact: Divide-by-zero is illegal on i386 and x84-64, but is a valid operation on ARM. Dividing by zero will cause crashes in the simulator, but not on iOS devices.

Troubleshooting

If you aren’t seeing crashes, there are a few common issues you can check for:

  1. Crashes are processed in real-time after you relaunch the app post-crash; make sure you’ve relaunched your app and that it launches fully in the foreground.
  2. Using the Simulator to test your app? Xcode’s debugger prevents us from capturing crash reports, but if you disconnect the debugger, then we’ll be able to capture them. Note that if your device is plugged into your machine, the debugger can still get in the way. To make sure Xcode’s debugger is disconnected:
    1. Launch the Simulator.
    2. Hit Stop in Xcode.
    3. Launch your app in the Simulator and cause a crash.
    4. Hit Run in Xcode.
    5. The crash report will show up and you can see console output indicating that the report has been sent.
  3. Make sure our SDK line is after all other 3rd-party SDK lines that install an exception handler. (We need to be last one called in your appDidFinishLaunchingWithOptions method.)
  4. It’s possible, but rare, that we are missing a dSYM to symbolicate any crash reports. There will be an alert on your dashboard if this is the case. Click through to upload the missing dSYM. Keep in mind that exceptions are not guaranteed to crash. The full code path, including code in system libraries, matters here. If you aren’t seeing the dSYM alert, you can go to your app’s settings page, and append “/mappings” to the URL to reach it, e.g. https://fabric.io/settings/apps/some_app_id/mappings