AppStore app version along side beta, debug build on Apple Watch & iPhone

August 9, 2015

It’s quite handy to have multiple builds of same app on one device for developing purposes. I usually setup three different builds. I like to have AppStore version alongside βeta version that is distributed to testers, as well as having separate debug builds. Last is only used when I directly build and run from Xcode. This involves having different bundle ids.builds_watch Therefore there will be multiple app ids and provisioning profiles that will need to be created. It’s a drawback, but one well worth the costs. I hate when I want to show off the app to someone but build I have on the device is buggy development version. Or when tester is trying to show me bug he/she found, but I haven’t got the same build as he/she does, on my device. All that is gone with multiple bundle ids setup. I also like to render version and build numbers into the app icon. However that’s a topic for another blog post. For now I will only create different icon for each of the build. Also for now Im going ignore issues that come up with TestFlight, but will address them else where. With Xcode 7 GM being less then a month away, following steps are for Xcode 7 beta 5. Without further a due here is how its done.

Assuming you are working on an app called Pure Awesome. Firstly duplicate Debug and Release configurations in Project Settings / Info tab. Name them DebugBeta and ReleaseBeta01_build_configuration

In menubar navigate to Product / Schemes / Manage Scheme … Make sure shared checkbox is on and duplicate schemes for iPhone and Apple Watch apps. Name them Pure Awesome Beta & Pure Awesome Watch Beta.02_dubplicate_schemes

Edit Pure Awesome Beta & Pure Awesome Watch Beta. Change all instances of Debug and Release configurations to DebugBeta and Release beta respectably. You’ll have to change them in Run, Test, Profile, Analyse and Archive.03_edit_schemes

Select Pure Awesome target, in Build Settings tab change Product Bundle Identifier for DebugBeta to $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome-Debug. In my case is uk.co.stringcode.Pure-Awesome-Debug. Change product bundle identifier for ReleaseBeta to $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome-Beta. Change Product Name for DebugBeta to PA Debug and PA βeta for ReleaseBeta.04_bundle_id

Select Pure Awesome Watch target, in Build Settings tab change Product Bundle Identifier for DebugBeta to $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome-Debug.watchkitapp In my case is uk.co.stringcode.Pure-Awesome-Debug.watchkitapp. Change product bundle identifier for ReleaseBeta to $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome-Beta.watchkitapp. Do not change the product Name in here.05_bundle_id

In menu bar navigate to Editor / Add Build Setting / Add User-Defined Setting. Name it WK_COMPANION_APP_BUNDLE_IDENTIFIER and fill appropriate product bundle identifiers for all schemes (these are your main iPhone app product bundle identifiers, ei $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome, $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome-Debug etc).06_WK_COMPANION_APP_BUNDLE_IDENTIFIER

Open Pure Awesome Watch App Info.plist in Project Navigator. Change value of WKCompanionAppBundleIdentifier to $(WK_COMPANION_APP_BUNDLE_IDENTIFIER).07_watch_info_plist

Select Pure Awesome Watch Extension target, in Build Settings tab change Product Bundle Identifier for DebugBeta to $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome-Debug.watchkitapp.watchkitextension In my case is uk.co.stringcode.Pure-Awesome-Debug.watchkitapp.watchkitextension. Change product bundle identifier for ReleaseBeta to $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome-Beta.watchkitapp.watchkitextension. Do not change the product Name in here. 08_bundle_id

In menu bar navigate to Editor / Add Build Setting / Add User-Defined Setting. Name it WK_APP_BUNDLE_IDENTIFIER and fill appropriate product bundle identifiers for all schemes (these are your Watch app product bundle identifiers, ei $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome.wachkitapp, $(YOUR_COMPANY_IDENTIFIER).Pure-Awesome-Debug.watchkitapp etc).
09_WK_APP_BUNDLE_IDENTIFIER

Open Pure Awesome Watch App Extension Info.plist in Project Navigator. Change value of WKAppBundleIdentifier to $(WK_APP_BUNDLE_IDENTIFIER) which is located in NSExtension / NSExtensionAttributes / WKAppBundleIdentifier.10_watch_app_extension_info_plist

At this point we can run multiple builds in simulator. Next thing to do is to create two additional icon sets for iPhone and Watch apps. Original Icon set is named AppIcon. Create AppIconBeta and AppIconDebug for both devices. Select Pure Awesome Target. In Build Settings tab change values of Asset Catalog App Icon Set Name to AppIcon for Debug and Release (default values), DebugBeta to AppIconDebug, ReleaseBeta to AppIconBeta. Do the same for Watch App target.11_app_icon

Lastly we need to create app ids and provisioning profiles. Do not press Xcode fix it button when trying to build in absence of provisioning profiles, ever ! Otherwise you are just asking for trouble. You are going to to have to create following app ids and profiles (no need for each app id to both development and distribution profiles) :

For iPhone

uk.co.stringcode.Pure-Awesome

  • Development Profile (Pure Awesome Development)
  • Distribution Profile (Pure Awesome AppStore)

uk.co.stringcode.Pure-Awesome-Debug

  • Development Profile (Pure Awesome Debug Development)

uk.co.stringcode.Pure-Awesome-Beta

  • Distribution Profile (Pure Awesome Beta AdHoc)

 

For Watch App

uk.co.stringcode.Pure-Awesome.watchkitapp

  • Development Profile (Pure Awesome WatchApp Development)
  • Distribution Profile (Pure Awesome WatchApp AppStore)

uk.co.stringcode.Pure-Awesome-Debug.watchkitapp

  • Development Profile (Pure Awesome Debug WatchApp Development)

uk.co.stringcode.Pure-Awesome-Beta.watchkitapp

  • Distribution Profile (Pure Awesome Beta WatchApp AdHoc)

 

For Watch App Extension

uk.co.stringcode.Pure-Awesome.watchkitapp.watchkitextension

  • Development Profile (Pure Awesome WatchApp Extension Development)
  • Distribution Profile (Pure Awesome WatchApp Extension AppStore)

uk.co.stringcode.Pure-Awesome-Debug.watchkitapp.watchkitextension

  • Development Profile (Pure Awesome Debug WatchApp Extension Development)

uk.co.stringcode.Pure-Awesome-Beta.watchkitapp.watchkitextension

  • Distribution Profile (Pure Awesome Beta WatchApp Extension AdHoc)

Once created assign corresponding profiles to all targets.
12_profiles
Sample project can be found here.

#Blog posts, #Coding, #iOS Development