Question

It is important to make sure every iOS application submitted to the AppStore is under 20MB in size so that it can be downloaded over-the-air.

I am working on an app that may be getting close to that limit, and I've discovered that there does not appear to be an easy way to tell the current output .app bundle size from within XCode.

In XCode4 in particular - by default every build is tucked away in a hard to get at and cryptically named temp directory. I don't want to override this default behavior unless I have to.

I know I can track down the .app bundle by looking at the build logs, opening a shell window, changing to that directory, and using 'du' - but I am hoping to find a quicker and easier way to keep track of the .app file size after each new build.

There isn't even an easy way directly on an iPhone or iPad to determine the size of an application. Mostly I appreciate this - but not when I am in the midst of optimization.

Any thoughts on best practices?

UPDATE: I am using XCode 4 now for most of my day-to-day development, and it seems that every solution so far doesn't work on XCode 4 either because functionality has changed or features (such as Archiving) are still coming soon. I think the ultimate answer may be "use XCode 3" for the particular phase of development. I know I will still need to use XCode 3 for the final build and submission anyway...

Was it helpful?

Solution

Create a script (perl, bash, AppleScript, whatever...) and add it to your Build Scripts. The script can then cd to magic location, zip the .app to /tmp, du -s -h the resulting zip, and pipe the output to some log file... maybe even flash bright red warning lights hooked to a USB parallel port relay to warn you of exceeding some file size limit.

OTHER TIPS

Where I work, we make an archive form Xcode (Build and Archive) and then we export that archive on the disk from the Organizer Window (using the Share button).

This will generate an .ipa file. The size of that file is what you're looking for.

There should be a 'Products' folder in your Xcode project. Inside that folder will be your .app files. Right click on your file and select 'Reveal in Finder'.

Actually, it is the size of the .ipa, not the .app, that has to be under 20MB. Since .ipa is a zip archive, you get a little more space to work with. The only way of finding the size that I know of would be to do a Build and Archive in XCode and look at the file size in Finder.

The file you send to Apple is a .zip file, it's your compressed binary file. For example I'm working on an app that's over 120mb uncompressed but compresses to about 19mb as it's mostly data. I'd guess you have plenty of slack is most of your files aren't a compressed format.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top