Distribute macOS App using CloudKit in Xcode 8

Harry Ng
macOS App Development
3 min readSep 17, 2016

First of all, this title is written in such specific conditions, based on the struggles I have faced recently.

Xcode 8 officially released in Sep 2016

Using or Outside App Store

Due to legacy reasons, developers can distribute apps either in one of the two ways:

  1. Mac App Store
  2. Outside App Store (usually announced in official website)

A recent research shows that more developers prefer to opt out from App Store. It is so not only due to 30% commission to Apple, but also complaints to limited support. Companies or apps like Sketch, Hipchat and many others made their moves.

Basic Distribution workflow

There are several steps to prepare for distribution.

  1. Archive
  2. Validate
  3. Distribute

Distribute CloudKit App

If you are building an app with CloudKit support, especially if you already have the iOS or tvOS counterpart, you may want to follow these steps.

  1. Develop the application in CloudKit “Development” environment.
  2. Change to CloudKit “Production” environment, while the app is still running in Debug mode.
  3. Distribute the app either to App Store or other channels using the Production environment.

The 2nd step here is what requires Xcode 8. I confirmed that running the app in Xcode 7.3.1 after pointing to CloudKit Production environment will yield “code signing error”. The app won’t launch as a result.

Distribute outside App Store

In case you want to distribute some beta apps, there is no TestFlight facility in place. Also, in order to share with more beta testers, the suggested way is to release outside App Store.

An option for sure is to export the application without signing the application. However, Apple takes security very seriously. So for usual beta users which are not tech-savvy, they may come back complaining not able to install app. Thus, we are going to code sign the application using “Developer ID”.

Only Team Agent of the Apple Developer team is eligible to create Developer ID certificate. There are two choices, Application and Installer.

“Developer ID: Application” is used to code sign the application for distribution.

“Developer ID: Installer” is used to create *.pkg installer file.

The steps of distributing CloudKit app outside App Store would be:

Step 2
  1. Develop the application in CloudKit “Development” environment.
  2. Change to CloudKit “Production” environment, while the app is still running in Debug mode.
  3. Remove Push Notification entitlement.
  4. Archive the app
  5. Validate to see the app is connecting to Production environment
  6. Export the app using Developer ID
  7. Distribute the app to the beta users

--

--