Skip to content

Instantly share code, notes, and snippets.

@eugenpirogoff
Forked from fbeeper/easyiossymbolication
Created February 22, 2016 08:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eugenpirogoff/b9b4d9655073eeeb48b2 to your computer and use it in GitHub Desktop.
Save eugenpirogoff/b9b4d9655073eeeb48b2 to your computer and use it in GitHub Desktop.
Looking for an easy way to symbolicate crashes?

Fool'n'Lazy-Proof iOS Crash Symbolication

For some reason, -that is not important now,- you might find yourself looking at a cryptic .crash...

Symbolicating it is as easy as running this Xcode script:

symbolicatecrash -v <.crash file> <.app/app binary> > <.crash output file>

Despite that, I created a script for the fool and lazy (as myself) holding an .ipa, and not wanting to remember where symbolicatecrash is.

Cheers! :boom:

TL:DR;

Just run this script on a folder with your .ipa, the corresponding .dSYM, and (1+) .crash file/s.

Will output symbolicated sym-*.crashes for you.

#!/bin/bash
#
# Fool'n'Lazy-Proof iOS .crash Symbolication
#
# Just run this script on a folder with your `.ipa`, the corresponding `.dSYM`,
# and (1+) `.crash` files. Will output symbolicated `sym-*.crash`es for you.
#
# Copyright (c) 2016 Ferran Poveda (@fbeeper)
# Provided under MIT License (MIT): http://choosealicense.com/licenses/mit/
function checkForRequiredFileOfType()
{
count=`find $1 -print -quit 2> /dev/null | wc -l | awk '{print \$1}'`
if [[ $count > 0 ]]; then
echo "Found a $1 file"
else
echo "Missing a $1 file! Need *.ipa + *.dSYM + *.crash files."
exit
fi
}
function checkForRequiredFiles()
{
checkForRequiredFileOfType "*.ipa"
checkForRequiredFileOfType "*.dSYM"
checkForRequiredFileOfType "*.crash"
}
# Define location of symbolicatecrash binary (defaults to Xcode 7 location, but can be defined on params)
symbolicatecrash=${symbolicatecrash:-/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash}
# Let's make sure you haven't forgotten any file
checkForRequiredFiles
# Extract .ipa and define where the binary is (assuming it has the same name)
ipa=`find *.ipa -print -quit`
bsdtar -xf "$ipa" -s'|[^/]*/||'
app=`find *.app -print -quit`
app="$app$/${app%.*}"
# Symbolicate all .crash files
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
for i in *.crash; do
if [[ ! $i == sym* ]]; then # Skips previous output files from this script
"$symbolicatecrash" -v "$i" "$app" > "sym-$i"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment