67 MB ipa from Apple downloads as 44 MB but expands to 288 MB on the phone, no such issues for Google Play.

(Edited with the latest and more accurate info.)

Hi. We are working on a word-game project, with hundreds of small image files (letter-point combinations for various languages etc.) and as you can imagine, we have a compression problem. When we make an Android built from PC and send it to Google Play, no problem, when we make an iOS built and send it to xCode on Mac, still no problem, but once the 67 MB built from xCode is sent to Apple Store for tests, somehow it expands to 288 MB during installation when it comes back on the phones. Now we know that it would be best to have one big combined image and use it by mappings (even though I don’t know if that could be done in our case), however we are looking for a solution to fix our current issue with minimal effort. Therefore two questions arise:

  1. What is the best way to compress those images, so that they would not expand once downloaded from the Apple store?

  2. Is there a shortcut to make the compression changes without having to navigate through hundreds of folders in Unity editor?

Thanks in advance for any help you can provide.

Cheers.

Does this get expanded to 350Mb as a download from the Apple store, or does it download smaller but then get de-compressed on the device to 350Mb?

If it’s the second then it does seem over the top, but the metric you really care about is making sure that the download itself is less than 100Mb (but smaller the better obviously!)

To understand what’s happening, you should first understand what happens when you submit to the app store. Apple will take the IPA you upload, extract the contents and encrypt everything other than the executable file. It’ll then take the executable and encrypted data and re-compress into an IPA ready for download. In practice, with Unity projects this does add on quite a bit (normally something like 20-30Mb rather than 300 though!). One of the big offenders here is a lot of contiguous 0’s in the final compression, but you can’t control that too much…

A few ideas for helping though:

  1. Make sure you’re only including libraries you need
  2. Play around with the stripping level and make sure you’ve got something appropriate.
  3. Check the version of Unity you’re using to see if there are known issues. Generally 4.6 will produce a worse result than 5.1 (not really tested enough of 5.2 or 5.3 to give a verdict on that)
  4. Make sure that the assets being built are assets you need, remove anything that you don’t need (no matter how small as this could effect your final compression after encryption)

If that doesn’t help then looking at the way you have generated your sprites is all you’ve got left. To be honest, it’s worth double checking all this anyway to help with your run-time memory usage

  1. Is it possible to have these as one sliced image?
  2. Do you really need these as individual sprites or can you have a few backgrounds and just layer the text on top (TextMeshPro might help out here).
  3. Are all your sprites sensibly sized? This includes the possibility of making them Power of Two (so if you’ve got something that is 110px x 96px, making it 128x128 and setting the compression to PVR may help)

Finally, if you want to make compression changes en-mass, you can usually just multi-select the files you want to edit through the project browser (applying filters will help), but it might not be possible depending on how they are currently set-up. You might need to actually change your source files to get the best compression out if it too (i.e. making them PVR is better for memory, but it’s terrible with gradients).