Make my app smaller, so that it is faster to download and install?
Before trying any optimizations, you should measure. Some of the techniques in this document are tradeoffs with downsides that must be considered. You must measure their impact to be sure you’re making the right tradeoff. Without measuring, you can’t know what kind of change you’re making.
The app distribution process produces a number of different artifacts, each with its own purpose and size. It’s important to understand what each artifact represents and which artifacts to use when measuring your app’s size.
- An app bundle is the
.app
bundle containing all of the binaries in your app, plus all of your app's resources, such as images. This bundle contains everything needed for your app to run on every supported device. For the purposes of this document, an app bundle only refers to the.app
produced by archiving your app. - An App Store submission .ipa is created from an Xcode archive when uploading to the App Store or by exporting the archive for iOS App Store Deployment. This
.ipa
is a compressed directory containing the app bundle and additional resources needed for App Store services, such as.dSYM
files for crash reporting and asset packs for On Demand Resources. - A universal .ipa is a compressed app bundle that contains all of the resources to run the app on any device. Bitcode has been recompiled, and additional resources needed by the App Store, such as
.dSYM
files and On Demand Resources, are removed. For App Store apps, this.ipa
is downloaded to devices running iOS 8 or earlier. - A thinned .ipa is a compressed app bundle that contains only the resources needed to run the app on a specific device. Bitcode has been recompiled, and additional resources needed by the App Store, such as
.dSYM
files and On Demand Resources, are removed. For App Store apps, this.ipa
is downloaded to devices running iOS 9 or later. - A universal app bundle is the decompressed universal
.ipa
. The installation process decompresses the universal.ipa
and installs the universal app bundle. - A thinned app bundle is the decompressed thinned
.ipa
. The installation process decompresses the thinned.ipa
and installs the thinned app bundle.
Getting an App Size Report
Xcode provides reporting tools to help you understand the size of your app. To generate the size report:
- Archive your app.
- Export your archive for testing outside the store.
- Select “Export for specific devices” and choose “All compatible device variants” from the pop-up menu.
- Select “Rebuild from bitcode.”
In the output folder, you will find App Thinning Size Report.txt
, which breaks down the compressed and uncompressed file sizes, plus the size of any On Demand Resources, for each device type. An example of this file is in Listing 1.
You can also use xcodebuild from the command line to export an Ad-Hoc archive with options to create the thinned .ipa
files and get the app size report.