If you’ve written any kind of non-trivial application from the iPhone, you’ve had to deal with debugging it while not in the debugger. Sometimes you may even need to get at the preferences file and other support files, such as “saved state” files to see what went wrong.

There are two main ways to go about retrieving application data for your iPhone applications, depending on whose phone you want to get it off of. If it’s your personal phone you do development on, it’s pretty easy. If you need to get data from someone else, like say a beta user, it’s much more involved.

For your iPhone

If you’re on your development machine and iPhone, Xcode provides a pretty simple way to get at the data.

  1. First, dock your iPhone, then open Xcode.

  2. In Xcode, open the Organizer, via the Window > Organizer menu item.

  3. Select your iPhone in the source list on the left.


  4. On the right, locate the Applications list. Find your application, and disclose the disclosure triangle to the left of the name.


  5. Select “Application Data” underneath the name of your application, and press the button on the right, the down arrow image.

  6. You will be prompted for a place to save it. Pick a place, and press “Save.”

You now have your application data onto your Mac, where you can debug it. You can either go to the Finder to browser it, or it is also added to the Organizer window in Xcode, under the “Projects & Sources” tree.

For a beta tester’s iPhone

If you are running a beta and you need to get data from your application to debug, things get pretty tricky. The general idea is you get your beta user to find the iTunes backup files (yes, more than one) that contain your application data, and have them send them to you. Then, using a third party python script, you uncompress the backup files, and hope that they actually contain the correct files.

  1. First, if the user does not yet have a backup (unlikely), they should force one. Do this by selecting the iPhone in iTunes, right clicking (or control-click) and selecting “Backup”.


  2. Next, the beta user should open the Finder and go to ~/Library/Application Support/MobileSync/Backup. With any luck, there will be one folder here, which will be the 40 character hexadecimal device ID of their iPhone. Navigate inside this folder.

  3. In the Finder, switch to list view and sort by modification date.


  4. At this point, your beta user needs to select the appropriate backup files that contain the data you need (haha). Depending on your user, you may want them to just zip up the entire folder and send it to you. Be warned though — it’s huge.

    To be more selective, you only want the files ending in “mdbackup.” These files can be grouped based on modification date. For example, in the screenshot above, you can see that a backup happened Today, at 5:06 PM. The beta user could select all of the mdbackup files with a modification date of “Today, 5:06 PM”, zip them up, and email them to you.

    The thing to note here is that iTunes only does incremental backups. If your application data has not been modified since the previous backup, the current backup will not have your data in it. So you may need to repeat this step several times with your beta user until they find the right backup.

  5. At this point the beta user should zip up the “mdbackup” files, however you had them select them, and email them to you.

Things are now in your, the developer’s, hands. You need to convert the mdbackup files into something you can use.

  1. First, download iphone-backup-decoder from Google Code. iphone-backup-decode is a Python script that will unarchive all those mdbackup files you now have.

  2. Next, make a directory that you can work in, called “Backups” (or whatever you want to call it). Place all your mdbackup files in here, and move decode_iphone_backup_v2.1.py file here as well.

  3. Before you can run the python script, you need to make it executable. In Terminal.app, cd to your “Backups” folder, and type the following:

    chmod a+rx decode_iphone_backup_v2.1.py

  4. You are now ready to run the decoder, by typing in Terminal:

    ./decode_iphone_backup_v2.1.py *.mdbackup

    This will unarchive all mdbackup files current in the “Backup” folder, so keep that in mind if you’re going through multiple backups.

The results should now be in a folder called “MobileSyncExport” inside your “Backups” folder. If you are very lucky, it will contain the files you need.

If you need to repeat these steps, I would advise deleting all the mdbackup files and the MobileSyncExport folder from your Backups folder. The decoder script will most likely give undesirable results if you decode two backups that contain the same file.