Exporting Device-Specific Binaries - Swift 2.0, Xcode 7 and Interface Builder - iOS 9 Swift Programming Cookbook (2015)

iOS 9 Swift Programming Cookbook (2015)

Chapter 1. Swift 2.0, Xcode 7 and Interface Builder

1.6 Exporting Device-Specific Binaries

Problem

You want to extract your app’s binary for a specific device architecture to find out how big your binary will be on that device when the user downloads your app.

Solution

Follow these steps:

1. Archive your app in Xcode.

2. In the Archives screen, press the Export button.

3. Choose the “Save for Ad Hoc Deployment” option in the new screen and press Next.

4. In the new window, choose “Export for specific device” and then choose your device from the list.

5. Once you are done, press the Next button and save your file to disk.

Discussion

With iOS 9, Apple introduced bitcode. This is Apple’s way of specifying how the binary that you submit to the App Store will be downloaded on target devices. For instance, if you have an asset catalogue with some images for the iPad and iPhone and a second set of images for the iPhone 6 and 6+ specifically, users on iPhone 5 should not get the second set of assets. You don’t have to do anything really to enable this functionality in Xcode 7. It is enabled by default. If you are working on an old project, you can enable bitcode from Build Settings in Xcode.

If you are writing an app that has a lot of images and assets for various devices, I suggest that you use this method, before submitting your app to the store, to ensure that the required images and assets are indeed included your final build. Remember, if bitcode is enabled in your project, Apple will detect the host device that is downloading your app from the store and will serve the right binary to that device. You don’t have to separate your binaries when submitting to Apple. You submit a bit fat juicy binary and Apple will take care of the rest.

See Also