Our DNA is written in Swift

Taking Stackshots

You know how to take screenshots on your iOS device and that is quite useful when filing bug reports because as they say “a picture is worth a thousand words”. But there are situations – happened to me recently – when an app is non-responsive and a screen shot wouldn’t really tell much of a story.

Especially when dealing with BETA software it is useful to also commit to memory how to take stackshots.

Apple has detailed instructions how to retrieve a variety of additional information that is useful to collect to accompany bug reports. I’m copying on section here because my blog is my knowledge base and by explaining it here I am also going to remember it in the future. I’ve recently had two Radars submitted where this ability would have made the bug report orders of magnitude more useful. But since I didn’t know at the time how to take stackshots the opportunity is forever gone, as I am now unable to reproduce the issues.

So you better try out this process right now so that you will have the clarity of mind the next time to take several stackshots after encountering any part of iOS being stuck or hanging.

1. Reproduce the issue you’re reporting
2. Press the Home button on the touch screen face of the device and one of the volume buttons on the side of the device at the same time to create the stackshot file.

Note: Please press this button combination several times to capture multiple stackshots when the issue is occurring.

3. Sync your device with iTunes
4. Files starting with “stacks” in this format “stacks-yyyy-mm-dd-xxxxxx.log”, should appear after the sync is completed in a folder on your host computer like the ones listed below with today’s date in place of the yyyy-mm-dd portion of the strings below:


~/Library/Logs/CrashReporter/MobileDevice/<iPhone name>/stacks-yyyy-mm-dd-xxxxxx.log

Note: “~/” your user folder or /Users/[your_user_name_here]/Library/Logs/… not the root level /Library/Logs/… path

5. Attach the stackshot files that correspond with the dates of your button presses to the bug.

Once Again With Feeling

For me producing stackshots didn’t in any way give visual or acoustic feedback, which confused me at first. Rather the springboard skip to the search page or the Ringer volume would change. But even then logs were produced.

The above official instructions might cause you a weird feeling to go with “what?! I need to synch with iTunes for that?” Don’t worry, you don’t need to. Xcode Organizer also will also let you access device logs and from there you can also export individual reports.

Stackshots in Xcode Organizer

Those stackshots have the funny exception code 0xbaaaaaad. There is a slight problem if you try to export multiple files at the same time via the Export button. Organizer will only create one output file in a folder by the name you choose per combination of Date, Hours and Minute. If you do as you where told and created multiple stack shots then you lose all but one per minute.

Instead of exporting you can drag&drop the stackshots to your Desktop. This gets them automatically be suffixed -1, -2 and so you get all stack shots exported. BTW they get exported with the crash file extension, as opposed to the log extension that you would get via iTunes sync.


Remember: Home and Power = Screenshot, Home and Volume = Stackshot.

Stackshots are useful for:

“freezes and hangs with your iOS device, or for issues that engineering has requested stackshots.”

Next time I encounter a hanging iPhone or Apple app I’ll know how to provide the information that Apple engineering will inadvertently desire. Information that you only have a single opportunity to collect if it is a Heisenbug you just witnessed. Better to have those stackshots created and not needing them, then the other way around.

Categories: Recipes