meisel
meisel

Reputation: 2429

Estimating the size that an iOS app would be on the app store

Apple mentions in https://developer.apple.com/library/content/qa/qa1795/_index.html that the compressed app they generate when exporting for development deployment is smaller than the app that people actually download from the app store because, before compressing, they encrypt the app payload.

Firstly, why wouldn't they encrypt before compressing, rather than compress before encrypting? It seems to increase the size of app by 90%.

Secondly, is there a way for me to simulate what Apple does so that I can estimate how big it will be, and if it will go over the 100MB WWAN download limit?

Upvotes: 1

Views: 141

Answers (2)

zaph
zaph

Reputation: 112857

Firstly: The result of encryption is indistinguishable from random data. Compression relies on repeated sequences. Since random data does not have repeated sequences it is incompressible. Therefore encrypted data will not compresses.

Secondly: Apple encrypts the code portion and that does not compress. Simulate what Apple does: only compress the non code section, add the code section and check the size. That should be close. (No need to encrypt the code, encryption does not change the size.)

From SAI Peregrinus on Cryptography: Compress then Encrypt will reduce the size of the ciphertext, but ruins security. Compress then Encrypt can be secure for storage of data at rest. See the linked answer for more details.

Upvotes: 2

Paras Gorasiya
Paras Gorasiya

Reputation: 1351

The "Size" listed in the App Store can be different on different devices for a multitude of reasons: App Thinning, compression, etc. as long as the compressed size of your app is under 100 MB (the size of the actual data downloaded). So, you should not worry about the app size after decompression because it's usually not considered for downloading an app via cellular connection.

Your users should be able to download it on a cellular connection. But also note that if the user's device has enough disk space for the "Download Size," but not the "Install Size," they will not be able to install the application, as there will not be enough space on the device to unpack it.

Upvotes: 0

Related Questions