Search code examples
xcodecloudkitcloudkit-environments

Run Mac App with CloudKit connected to the Production environment


Has anyone succeeded to run a Developer ID signed Mac App with CloudKit and with access to the Production environment, using Xcode 8 beta 3? According to this diagram of Apple it should be possible, but all my attempts lead to crashes. What are the exact steps to follow?

My attempts until now includes the use of a "Mac DirectDistribution" Provisioning Profile that points to an App ID with CloudKit enabled and with access to an iCloud Container.

My CloudKit enabled-app works perfectly with a standard App Store configuration, but I want to test it with a Production environment.


Solution

  • After countless experiments I found the following working solution to test CloudKit on the Mac with Production data, using Xcode 7.3:

    1. In your App project, choose Developer ID in Targets > Identity > Signing
    2. In the Entitlements file add a new line with key "com.apple.developer.icloud-container-environment" with value "Production"
    3. Run the App (debug modus)

    Export the app to an Archive, choose Export and select "Export as a Mac Application" to produce a Developer ID-based release version.

    The steps are more or less the same if you use Xcode 8, but you have the extra option to disable the App Sandbox.