Darknoon

Darknoon Blog » Peeking into iPhone Apps

26 Nov 2008

Peeking into iPhone Apps

Ever seen an interesting effect in a third party app and wondered how it worked? Want to check out how another app stores its resources? Here’s the step-by-step on how to go about doing it.

I assume you have at least a little experience with the Terminal and that you’re running Mac OS X 10.5.
Here’s how to take apart an iPhone app and look at its resources:

  1. Right-click the application icon in iTunes > select “Show in Finder”
  2. Copy the .ipa file to a new location
  3. Change the file extension to .zip
  4. Unarchive the zip, and you’ll get a directory of files
  5. Take the App bundle from the “Payload” directory and use Get Info to remove the .app extension

Okay, now you can see all of the resources in the App bundle, but if you want to view any PNGs, you’re still out of luck. In the build process for an iPhone app, Xcode goes through and converts any PNGs into a special format. To change them back to standard PNGs that you can open in Preview or other apps, you’ll need to normalize your PNGs. I decided to go with the Python-based code for simplicity. The following assumes you use it as well:

  1. Save the python code to somewhere convenient
  2. Open a Terminal window
  3. cd into the application directory (the former .app bundle), as the script will normalize all PNGs in the current working directory or its subdirectories.
  4. Type “python <path to python script>”
  5. There will be a prompt; type “Y” for yes and hit enter. The script will now convert your PNGs!

This process can be useful if you’re curious about how some app works; sometimes you can get a good idea just from looking at its resources.

In a future post, I’ll detail some of my observations from peeking into other developers’ work.

—Andrew Pouliot  

5 Comments »

RSS TrackBack

  1. [...] week, in Peeking Into iPhone Apps, I talked about the process by which the contents of an App bundle can be read and deciphered. In [...]

    Pingback by Darknoon Blog » Deconstructing Classics.app — December 8, 2008 @ 3:20 am

  2. Great post!!! Helps me a lot.

    There is a way to see the code too? I’m a beginner iPhone dev and I’m stucked in find an example of how to do the flip effect in book readers like Stanza.

    Comment by Reinaldo — April 28, 2009 @ 7:26 am

  3. WoW!! great thanks for the info

    Comment by johmabassa — May 12, 2009 @ 10:18 pm

  4. How to undo the normalize so I can change the PNG and put them back to iPhone again? Is there any Python solution?

    Comment by memedai — July 8, 2009 @ 2:08 pm

  5. @memedai Xcode’s build scripts run them through pngcrush automatically, so all you need to get them back into the iPhone format is to add them to your project. If you want to do it manually, IIRC, the command is:

    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -iphone

    Comment by Andrew Pouliot — July 9, 2009 @ 11:43 am

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

©2008 Darknoon / Andrew Pouliot