Measure your app’s size, optimize its assets and settings, and adopt technologies that help streamline installation over a mobile internet connection.
Even when your users are in areas with good mobile network coverage, their download speeds can vary, or their data plan may limit the amount of available high-speed data. To ensure that app downloads don’t take a long time or result in additional costs to users, the App Store limits the size of the apps they can install over a mobile connection. If an app’s size exceeds the limit, users need to connect to a Wi-Fi network to install it. Keep your app well below the size limit to maximize your app’s possible install base and minimize installation time.
In addition to these issues, devices may have only limited storage available, making it even more important to be mindful about your app’s size. Consider measuring it as part of your development and testing process, and plan to optimize it as you develop it.
Before you start optimizing your app, you first need to measure its download and installation sizes. However, none of the binaries that you create for debugging or that you upload to the App Store from within Xcode are suitable for measuring your app’s size. For example, you can’t use any of the following binaries:
The APP file (the app bundle)
The XCARCHIVE bundle that you create when your archive your app
The IPA file that you upload to App Store Connect
Those binaries contain resources and files that aren’t part of the bundles that your users download from the App Store; for example, DSYM files for crash reporting.
During development, the only way to get accurate download and installation sizes for your app is to create an app size report on your Mac. However, if your app is available through the App Store or the TestFlight app, App Store Connect provides the most accurate size information. It displays the size for each variant of your app and warns you if it exceeds the limit for downloading over a mobile internet connection.
Apps distributed for testing with TestFlight contain additional data that an App Store build doesn’t have, so the TestFlight build is larger. This additional data isn’t included in your app when you make it available in the App Store. However, when compared to the binary you uploaded, the final size of your app after it’s approved for the App Store may end up being slightly larger. This size increase can happen when the App Store performs additional processing on your app’s binaries, adding DRM to prevent app piracy and then recompressing the binaries.
The following figure shows a common workflow for measuring your app’s size and performing optimizations.
To learn more about viewing the file sizes of a build in App Store Connect, see the App Store Connect Help.
The following two sections describe how you can generate a size report with Xcode, and how you can automate its creation.
Create the App Size Report
While App Store Connect provides the most accurate measurements of your app’s size, Xcode’s built-in reporting tools can create an app size report for you. It provides close estimates of your app’s download and installation sizes. To create an app size report:
Archive your app in Xcode.
Export your archived app as an Ad Hoc, Development, or Enterprise build.
In the sheet for setting the development distribution options, choose “All compatible device variants” for app thinning, and enable Rebuild from Bitcode.
Sign your app and export it to your Mac.
This process creates a folder with your app’s artifacts:
A universal IPA file for older devices. This single IPA file contains assets and binaries for all variants of your app.
Thinned IPA files for each variant of your app. These files contain assets and binaries for only one variant.
The output folder for your exported app also contains the app size report: a file named
App Thinning Size Report. This report lists the compressed and uncompressed sizes for each of your app’s IPA files. The uncompressed size is equivalent to the size of the installed app on the device, and the compressed size is the download size of your app. The following shows the beginning of the app size report for a sample app:
With the app size report you generate, you’re now ready to perform some basic optimizations, such as checking your binaries for unused assets, to reduce the size of your app. For more information, see Doing Basic Optimization to Reduce Your App’s Size.
Automate the Generation of the App Size Report
Instead of creating the app size report with Xcode, you may want to automate its generation in build scripts or continuous integration workflows. Run the following command to use
xcodebuild to export your app for distribution and create an app thinning size report:
Replace all file names and paths as neccessary. To create the app size report, provide
xcodebuild with an export options property list. Be sure to include the
thinning key, with
<thin-for-all-variants> as the value.
To learn more about using
xcodebuild, see Building from the Command Line with Xcode FAQ.