- Home /
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.
Answer by phil_me_up · Dec 14, 2015 at 07:50 PM
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:
Make sure you're only including libraries you need
Play around with the stripping level and make sure you've got something appropriate.
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)
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).
Thank you very much for this detailed answer. Let me answer your questions first. The archive in xCode is around 35 $$anonymous$$B but when we see it on TestFlight app, it is around 350. So this 35 $$anonymous$$B package is extracted to 350 $$anonymous$$B by the store itself. The package created by Unity for xCode is also very big (around 900 $$anonymous$$B) and when we check the log file we see that the engine extracts all small image files to 1,5 $$anonymous$$B. We excluded all the libraries and assets that were not needed. However we use 4.X version as we started the project with it (5.X was not there yet). As you also mentioned, we think the problem is about this image compression communication between Unity, xCode and App Store. We'll see about the advises you gave. Thanks again.
Sorry for the previous inaccurate info, we were mislead by the TestFlight app. Now when we check directly on iTunes Connect, we see that the ipa is around 67, downloads as around 44 and is installed for around 288 $$anonymous$$B (varies for each phone model of course).
Those numbers make more sense. The unzipped size on device seems high but not unbelievable (Unity projects tend to unzip quite large). I wouldn't worry too much about it in this case.
After doing some compression optimizations we managed to decrease the store size to 22 $$anonymous$$B and installed size to 87 $$anonymous$$B. We will try to decrease even more as we now know what to check. Power of two images and compression does the trick. Thanks.
Your answer
Follow this Question
Related Questions
iOS launch image is stretched for a brief second on start 1 Answer
image got pixelated on ios device 0 Answers
How to turn off default image compression upon import 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Only RGBA32bit works when setting Texture2D pixels on iOS? 0 Answers