Update: apparently this has also been discussed in the Unity forum and they reached about the same conclusion. It also shows more evidence that Unity Apps are hit pretty severely by the loss of compression due to the encryption process, 4-5 MB was what most users reported with some even much more than that.
I’m working on a calculation to at least determine the upper size of an App after Apple has had a go at it after a successful approval.
First of all we need to understand what Apple adds to the .app bundle after approval. I found a post that sums up the files that are added by Apple:
“additions are the iTunesArtwork file (70k), iTunesMetadata.plist (2k), files in the new SC_Info folder (12k) and the updated CodeResources file (9k)”
All in all about 100 KB in additional files. So where’s the rest of the bloat coming from? After all, some people even report an increase in size after approval of several Megabytes!
The answer is surprisingly simple: Apple is encrypting the executable file. By doing so its size doesn’t change much but its contents do which usually can no longer be compressed as much as before. By putting all this together i came up with a way to calculate the maximum size of your App in the App Store (it will most likely be less than this):
- open the .app bundle via right-click -> Show Package Contents (on Mac)
- locate the executable file and remember its (uncompressed) size (Size “A”)
- delete the executable from the bundle
- zip the bundle and remember the bundle’s compressed size (Size “B”)
Size “C” are the 100 KB from the additional files added to the bundle by Apple. The final calculation for the maximum size of your App is as follows:
A + B + C = maximum size of your App after approval
The calculation put in words:
(uncompressed executable size) + (app bundle compressed but without executable) + 0,1 MB = maximum size of your App after approval
I only have one App (51 Japanese Characters) in the App Store right now, so i can only test it with this App. The submitted App is 3,9 MB zipped and 4,3 MB on the App Store. The executable file is 1,0 MB and the App compressed without the executable is 3,6 MB. By my calculation i get:
1,0 MB + 3,6 MB + 0,1 MB = 4,7 MB
That is more than the 4,3 MB the App’s actual size on the App Store but remember: we calculated the maximum size the App might have. Depending on your code and more likely the engine you use (i use cocos2d exclusively till now) the amount of compression lost by Apple’s encryption varies greatly. Especially if assets (images, sound, music) are embedded in the executable (so don’t do that!). I hear that Unity iPhone applications can suffer a great deal more, however i don’t know if there was anything particular about the App nor which version of Unity iPhone was used, so take it with a grain of salt.
Now, how can we get closer to reality with this calculation? By introducing a good (upper) value for how much the executable file can still be compressed after encryption. In the case of 51 Japanese Characters it amounts to about 60%. So if we modify the calculation with a compression factor “F” we get:
(A * F) + B + C = maximum size of your App after approval
In the case of 51 Japanese Characters F would be 0,6.
I would very much appreciate it if you could do the calculation with your app(s) and post your results here. I’m most interested in your value for F, the more reports we can get the closer to the (mean average) compression factor for the encrypted executable. At this point i can only say it’s 0,6 in this particular case but it might as well be 1,0 for other Apps. Please post your results here!