Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Created June 2, 2016 10:16
Show Gist options
  • Save rolfbjarne/7ae2fd4c57c0fe83143b05f512d408b5 to your computer and use it in GitHub Desktop.
Save rolfbjarne/7ae2fd4c57c0fe83143b05f512d408b5 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
MTOUCH=/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch
XCODE=/Applications/Xcode73.app
if test -f /work/maccore/master/maccore/tools/mlaunch/mlaunch; then
MTOUCH=/work/maccore/master/maccore/tools/mlaunch/mlaunch
fi
echo "Listing devices..."
$MTOUCH --listdev --sdkroot /Applications/Xcode73.app/ | sed 's/:.*//' > devices.tmp
echo "Found `wc -l < devices.tmp | sed 's/ //g'` devices"
while read device; do
mkdir -p "$device"
echo "Listing crash reports on $device..."
$MTOUCH --list-crash-reports --devname "$device" --sdkroot $XCODE < /dev/null | grep -v "Please ensure" | grep -v "Connected to" > list.tmp
echo "Found `wc -l < list.tmp | sed 's/ //g'` crash reports"
while read line; do
if ! test -s "$device/$line"; then
DELETE=
if [ "${line: -4}" == ".ips" ]; then
# only delete things that look like crash reports
# you might not have an mlaunch that supports --delete-crash-report
# in which case comment out the next line.
DELETE=--delete-crash-report
fi
echo "Downloading $line from $device..."
$MTOUCH --download-crash-report "$line" --devname "$device" --sdkroot $XCODE --download-crash-report-to "$device/$line" $DELETE < /dev/null | grep -v "Please ensure" | grep -v "Connected to"
else
echo "$line is already downloaded."
fi
if test -f "$device/$line"; then
if ! test -s "$device/$line.symbolicated"; then
DEVELOPER_DIR=$XCODE/Contents/Developer $XCODE/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash "$device/$line" &> "$device/$line.symbolicated" < /dev/null &
fi
fi
done < list.tmp
done < devices.tmp
wait
say crash reports synchronized
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment