At Emerge, we think it's most important to track exactly what your users will see when it comes to app size.
Emerge's iOS app size metric is roughly equivalent to the unencrypted install size of your app on the latest iPhone hardware running the latest iOS version. Since install size is what users will see before downloading your app and before deciding if an app should be deleted, we think it’s the most important metric to track and reduce on iOS.
Users will see different numbers concerning app size depending on the location they download from or where they are on their device.
Since iOS 9, Apple has implemented App Thinning which detects the device type when downloading an app and ensures that only the code and assets needed for that iPhone/iPad are included in the app's size.
If you view an App Store page in a web browser, the size shown will be the universal app size, which means it's not thinned for any particular device. If you view the same app using the App Store on your iOS device you'll see the smaller thinned size.
The archive that you upload to the App Store and Emerge contains your app prior to any App Thinning.
iOS apps can be built for multiple architectures, most commonly 32 and 64 bit. The iPhone 5 was the last 32 bit iPhone, and iOS 11+ only supports 64 bit devices. Apple Watch apps also contain their own architectures. With App Thinning, only the architecture needed for a device will be included. This can cut the size of the code in your app in half. You can use the
lipo command to view and modify architectures in a binary. For example, you can list the architectures included in a binary like this:
lipo -archs MyAppBinary
Assets such as images, colors and .plist configuration files can come in different variants for different devices. This could be different images for each screen density, or even different configurations depending on the GPU class. Similar to how App Thinning works with architectures, it removes assets from your app that aren't needed for a given device. However, unlike architectures, asset thinning only works if assets are stored in Asset Catalogs.
Emerge will tell you if you have images that need to be moved into an Asset Catalog. You can slice a compiled Asset Catalog for a specific variant using the
assetutil command. For example, you can view the items in an Asset Catalog like this:
assetutil -I Assets.car
Bitcode is a mechanism for including an intermediate representation of your code, between source code and the final executable. If enabled, extra data will be included in the binary that you upload. That data is stored in a segment labeled
__LLVM. To check if this segment is included in a binary run:
otool -L MyAppBinary | grep "__LLVM"
If all binaries in your app use bitcode, Apple will use this data to re-compile the binary to a more optimized format that can reduce the size and deliver a final app without a bitcode segment. If you don't use bitcode you may need to implement these optimizations yourself. Emerge knows when your binary is not optimized and can suggest these changes automatically to you.
You can strip the bitcode in your binary using
xcrun bitcode_strip -r MyAppBinary -o MyAppBinaryThinned
All binaries downloaded from the App Store include encryption. On previous iOS versions, this encryption had a drastic effect on app download size, because an encrypted binary increased entropy and won't compress as well. On newer iOS versions this has been fixed, and app encryption doesn’t result in such a large increase to download size.
Encryption is applied after uploading to Apple, so all measurements you take of your app's size will be on an app that is not encrypted.
Apps are compressed before they are downloaded, so the actual number of bytes transferred will be lower than the amount of storage taken up by an installed app. Users can see both these numbers, but install size is more prominently displayed.
The install size is what you see when viewing the details for an app on the App Store:
By default, download size will only be displayed if an app is over the Apple determined limit of 200 MB and the user is not on Wi-Fi. Hidden in the iOS Settings app, users can configure the App Store to always warn them of the download size of an app before starting the download, still only when not connected to Wi-Fi.
Users can also review the app’s install size in the Settings app.
It's important to reduce install size, because this is what many users see when deciding if an app should be downloaded or what apps to delete.
Updated 6 months ago