Run CloudKit App Using the Production Environment From Xcode?

I'm getting ready to release a new app that uses CloudKit. I just deployed my Development schema to Production in CloudKit dashboard.

Is there a way to run my app from Xcode using the CloudKit Production environment for testing? Details of how to test in the production environment are described here: https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/CloudKitQuickStart/TestingYourApp/TestingYourApp.html

But would be faster (and easier for debugging potential issues) if I could select tell Xcode to use the production environment when running from the debugger. Is this supported?

Thanks

Ah, found the entitlement. com.apple.developer.icloud-container-environment. Documented here: https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_icloud-container-environment

Accepted Answer

Ah, found the entitlement. com.apple.developer.icloud-container-environment. Documented here: https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_icloud-container-environment

Yes, you can archive it and then: Distribute app  Ad Hoc iCloud Environment Then you can airdrop it to your iOS Device and test it.

EDIT:

SORRY, I DIDN'T GET YOUR QUESTION, I DON'T KNOW HOW TO RUN DEBUG TEST ON XCODE WITH CLOUDKIT PRODUCTION. But you can test it on a local device by exporting your app from Organizer on your local device.

Yes, you can archive it and then: Distribute app  Ad Hoc iCloud Environment: Production Then you can airdrop it to your iOS Device and test it.

Right. But my question was about running from Xcode with the debugger attached.

Apparently you can't run the app from Xcode (anymore?) using the entitlement I linked in my previous answer (I saw an old answer on Stackoverflow that seemed to indicate that using this entitlement was possible at some point).

When I try I get a code signing error: "Provisioning profile "iOS Team ProvisioningProfile: My.ProfileName" doesn't match the entitlements file value for "com.apple.developer.icoud-container-environment entitlement.

I tried creating a provisioning profile manually but with no luck.

Debuggability is controlled by the get-task-allow entitlement (com.apple.security.get-task-allow on macOS). When the Apple Developer web site creates a development profile, it includes that in the profile’s allowlist. Conversely, when it creates a distribution profile it does not. I suspect that, if you dump these profiles, you’ll see that the com.apple.developer.icloud-container-environment value follows the same logic, so development gets Development and distribution gets Production. If that’s the case then there’s no way to get debuggability and production iCloud.

To confirm this, dump the profiles using the techniques described in TN3125 Inside Code Signing: Provisioning Profiles.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Run CloudKit App Using the Production Environment From Xcode?
 
 
Q