How to Shrink Your App

March 29, 2012 Pivotal Labs

With the recent release of the new iPad, app resources (images, videos, etc.) will be significantly larger. Apple has raised the 3G app download to 50mb to compensate for the larger images, but it may still be a tight squeeze. This is especially true for universal apps that have to support low and high resolutions of iPhones, iPods, and now the iPads. Often during the construction of an app we will go through many revisions to the UI, moving new assets in and out of the app. In this confusion, there’s a chance that the developer might forget to remove the image as a resource from the project when it is no longer used.

We have written a script to automate the process of finding unused resources:

It’s simple to use, just clone the repo and invoke the script providing a relative path to the project’s working directory. For example:

./images_used.rb workspace/AngryBirds

The script can optionally include or exclude comments, and can be configured to provide a varying amount of output to the console. It recursively searches the provided project directory; looking at various files such as headers, implementation files, and nibs. It’s easy to edit the script to include resources of any given file extension.

There are some known issues, for example, stringWithFormat:@"%@.png" won’t work. Feel free to fork and please report bugs.

About the Author


More Content by Pivotal Labs
Hear Ye, Hear Ye: Town Hall is Now in Session
Hear Ye, Hear Ye: Town Hall is Now in Session

Last Wednesday we had our first Town Hall of 2012. For each quarterly event our founders, Amar and Sunny, c...

TDD Action Caching in Rails 3
TDD Action Caching in Rails 3

On my current project, we needed to prove that an action cache was working as expected. Alas, the blogosphe...

Enter curious. Exit smarter.

Register Now