Home My Book Contact

Symbolicating iOS Crash Files (Xamarin.iOS)

The last few days I have come across a few people needing to use .crash files from their running apps to debug issues. I was not really sure how to use them or if you even could when your app is built with Xamarin.iOS. I was surprised to find little conclusive information on the web, so hopefully this post will clear some things up while I share what I have learned.

If you are debugging your app locally and are connected to a device or in the simulator, you may be able to get the symbolicated crash log from Xcode directly:

  1. Open Xcode.app
  2. Navigate to the Window -> Devices menu
    Note: In Xcode 5, navigate to Window -> Organizer
  3. Select your device and choose View Device Logs
  4. Find the most recent crash log for your app in the list. You can use the Export menu to save the .crash file.

Screenshot of Xcode 6 Devices Menu

If the above does not produce a symbolicate crash file, continue on to symbolicate it.

Collect the Files

Place your *.crash, *.app and *.dSYM file in a directory somewhere convenient like the Desktop. Keep in mind that these three files need to correspond to the same build. The *.dSYM should be the matching file used to build the *.app, which is the same file that produced the *.crash. If you don't have matching files, the symbolication will not work and you will need to rebuild your *.app and keep a copy of the matching *.dSYM file. Once you have that, reproduce the crash with the app and symbolicate with the new *.crash file.

Create an Alias

Open Terminal and run one of these commands for your version of Xcode:

Xcode 8.x

alias symbolicate="/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash -v"  

Xcode 7.X

alias symbolicate="/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versi‌​ons/A/Resources/symbolicatecrash -v"  

Xcode 6.X

alias symbolicate="/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash -v"

Xcode 5.X:

alias symbolicate="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash -v"

This just makes using the symbolicatecrash tool easier by aliasing it to a symbolicate command so we don't have to navigate to that directory to run the command.

Update the Developer Directory

Run this command:

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"

Run Symbolicate

Open Terminal again and cd to the directory where you placed your files in the step above.

Run the symbolicate command we aliased before with your .crash and .app files as the parameters like this:

symbolicate -o "symbolicatedCrash.txt" "MyAppName 2-12-14, 9-44 PM.crash" "MyAppName.app"

This will symbolicate the crash file and spit out the result in a new file named "symbolicatedCrash.txt". Make sure that correct the file names from my example to match yours.

Analyze

Now you can stare at a symbolicated crash file and hope that some of it makes sense to you.

Conclusion

Make sure that you archive the builds you upload to the store along with the .dSYM file. This way you can symbolicate your crash reports easily. There is no way to rebuild a binary and then use an existing .crash file.