The Need
After the 1.0 of your app has shipped it is time to start working on version 1.1. One thing you will want to do is install the app store version and the dev version on your phone.
By default you will not be able to do this. The default Xcode project set-up assigns a single bundle ID for all builds of your app. Your phone only allows a single app with a particular bundle ID to be installed at a time.
The Solution
We want to set-up our project so that our development build and our release (app store) build differ in three ways:
- Their own bundle ID
- Their own app icon
- Their own app name
This will allow us to install multiple version of our app on our phone each with their own app icon and name to make it clear to us which is which.
How
We're going to add a new build setting that defines a custom suffix: CONFIGURATION_SUFFIX. This suffix will then be specified on a per build configuration basis.
To add a new user defined setting, click on the target and and then the Build Settings header. Hit the + sign and then tap on Add User-Defined Settings.
For our different build configurations (debug, release and beta) add in the appropriate extension.
- dev version will have a .dev suffix
- release version will have no suffix
- (optional) beta version will have a .beta suffix
We can then append this user defined setting to our specific build settings that control:
- Bundle ID
- App icon
- App name
Find the Product Bundle Identifier build setting and configure the value to be your BASE_BUNDLE_ID${CONFIGURATION_SUFFIX}
I.e., if your bundle is normally com.rocket.app then it should become com.rocket.app${CONFIGURATION_SUFFIX}. For each of your build configurations (dev, release) the values will automatically expand using the configured value from CONFIGURATION_SUFFIX under the user-defined setting.
Repeat this for the Product Name build setting.
The final step is to enable different App Icon images for the different build configurations.
To do this first update the Asset Catalog App Icon Set Name build setting so the value is AppIcon${CONFIGURATION_SUFFIX}. Again this will expand for each of the build configurations. E.g.,
Then, navigate to your asset catalog and add a new App Icon. Name it AppIcon.dev and (optionally) another named AppIcon.beta. The .dev and .beta extensions should match the configured values in your user defined CONFIGURATION_SUFFIX build setting.
After that, simply build and run!