Creating Debug Builds on iOS
If you are like me, you tend to use the same device for testing the version of your app submitted to the App Store and the version you are currently working on. It would be great if we could install those versions separately so that we can keep using the one from the App Store uninterrupted like a real user would do. This blog post shows you a quick and easy way to let both versions co-exist as shown in figure below.
Every iOS app has a bundle identifier that is used to uniquely identify it in the App Store. In order to have a separate entry for the debug build in iOS Springboard, we need to somehow differentiate its bundle identifier from the release build’s bundle identifier. We can achieve that by adding the value contained in
BUNDLE_ID_SUFFIX user-defined build setting as a suffix. Keep reading to find out how to create a user-defined build setting. We also need to give the debug build icon a different bundle display name so that we don’t accidentally tap the one from the App Store when we are testing the development version. That value is defined in another user-defined build setting named
Your project might not have
$(PRODUCT_NAME:rfc1034identifier)included in the bundle identifier. If you do, it will insert the product name into the bundle identifier. If the product name contains any white spaces or slashes, it will replace those with dashes. By default Xcode assigns the project name as the product name.
Xcode allows us to create as many build settings as we want. To create a new build setting, go to Project Navigator and click the project. After that select Build Settings tab for the target you need to add a build setting for.
Once a build setting is created, we need to provide a value for each build configuration as shown in the figure below. The bundle identifier suffix for a release build is deliberately left as empty. Whereas a debug build gets
.debug as the suffix.
That should force Xcode to create a completely new app and install it on a test device. The debug build will have
Debug as its bundle display name. Whereas the release build will have the actual name (
ReleaseMe) we want the real users to see. Now when we run the project a debug build should be installed as a separate app without overwriting the one that we downloaded from the App Store.