Cloudkit com.apple.developer.icloud-container-environment set to Production fails

I need to be able to test my Mac app (with CloudKit) in production mode. Setting this entitlement "com.apple.developer.icloud-container-environment: Production" results in:


Message from debugger: Terminated due to code signing error


In short - I'm unable to test it out. Documentation says we should be able to do this (like we are for iOS apps).


Reported as bug ID 22669141

Replies

I should add, even setting it to 'Development' causes it to not launch with a codesign error saying this entitlement is not allowed. WHY NOT!

Any movement on this? I want to write unit tests against my cloudkit usage and test in both development and production. I have the same issue.

Are you running your unit tests within your app? Or within the

xctest
process? Right now there’s no way to ‘bless’
xctest
with special entitlements, but if you run your unit tests within your app that should be able to use CloudKit.

To configure this, go to the target editor for your test target and, in the General tab, make sure that Host Application is set to your app rather than None.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I am having the same trouble as the original poster. This is not for unit testing, just trying to access the Production environment in CloudKit. I have done this from a couple projects with no trouble just by adding the key "com.apple.developer.cloud-container-environment" to my entitlements file with a value of "Production".


I am trying to do this to an existing app and running into issues where when I try to build to device I get an error:


"The executable was signed with invalid entitlements.

The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile. (0xE8008016)."


Any help here would be much appreciated

You should read through Technote 2415 Entitlements Troubleshooting, which describes the standard process for debugging entitlement issues like this.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

After reading through that document I confirmed using the methods it recommends that:


- The correct provisioning profile is being used for signing

- The provisioning profile contains the correct keys for hitting the iCloud Production Environment:

<key>com.apple.developer.icloud-container-environment</key>

<array>

<string>Development</string>

<string>Production</string>

</array>

- The entitlements for the signing are correct and include the key that usually works:

<key>com.apple.developer.icloud-container-environment</key>

<string>Production</string>


However the app is still failing to run with code signing errors

I’m going to bounce you to DTS here. I have some ideas about what’s going on but CloudKit entitlements are not my speciality and I’m reluctant to speculate about stuff that I haven’t personally tested.

Please open a DTS tech support incident and one of my colleagues will be able to set you straight.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Were you ever able to resolve this? I'm having the same problem, and my provisioning profile and entitlements are the same as what you have.

For the benefit of future readers, in my case, this error went away after I deployed to Production for the first time.

I also had a resigning error caused by missing icloud container entitlements saying:

Provisioning Profile does not contain: com.apple.developer.icloud-container-identifiers

Yet I had included the iCloud entitlement in the AppID / Provisioning Profile.


I fixed this problem by changing the iCloud Compatibility option of the AppID in the provisioning portal

from: Compatible with Xcode 5

to: Include CloudKit support (requires Xcode 6)


I rebuilt the provisioning profile with this change to the App ID.

Then it resigned correctly 🙂