问题
I have an iOS app built in Xcode 6 which uses an Asset Catalog to store 71MB of images. I have only includes the @3x images in my Asset Catalog to try and keep the size of the app under 100MB. The only exception to the @3x rule is that I have included @1x and @2x images for the AppIcon group.
All images are .JPG files with the exception of the AppIcon files which are .png files.
When I archive and create an .IPA file, the size of the IPA is 117MB. When I open and look at the size of the Asset.car file within the .IPA I see that it is 130MB. Contrast this to the Asset Catalog in the project which is 71MB. I am pointing this out to be clear that it's not other compiled code that is taking up 40 MB.
I would like to archive this app so that the file size stays under 80-90-MB if possible. The IPA should stay under 100MB given the 70MB of assets but I would like to know how to accomplish this or what other steps I might need to take or review to see why I am getting 130MB of an asset file in the IPA for 70MB of images.
回答1:
There is a new CAR tool: iOS-Asset-Extractor. This seems to be a better solution than "cartool" below.
Get cartool, build and run against your Assets.car file. That will create a directory containing the image files from the Assets.car.It is a simple command line tool. Not perfect but that should give you help understanding what is going on.
Then compare with what you expect and hopefully you will be able to figure out what is going on..
From what I understand .jpg files are converted to .png. If you have assets that are large consider including them directly or as a folder reference. This is particularly true if you are reading in the images in your code.
回答2:
The article at Assets.car is 6 times larger than actual Images.xcassets folder when archived seems to be the answer.
The entire set of JPEGs in my Asset Catalog is converted to PNG's which are substantially larger. I converted everything except for my AppIcons and LaunchImage out of the Asset Catalog and into a normal folder. So at that point i had a folder full of JPEGs and a small Asset Catalog.
When I created an archive it was 67 MB so significantly smaller!
来源:https://stackoverflow.com/questions/28302366/what-contributes-to-the-size-of-assets-in-an-ios-app-and-how-can-i-shrink-this