Using TestFlight with CloudKit development environment Using TestFlight with CloudKit development environment ios ios

Using TestFlight with CloudKit development environment


I have also tried to do that, but I don't think it is possible. TestFlight is primarily for apps "that you intend for public release on the App Store." If you are beta testing with iTunes users, Apple expects you to be using the Production server, as the users will expect their content to survive over to the released product.

Personally, I just decided to switch to Production when I started using TestFlight. If you are just testing with internal users, then you still have the option of Ad Hoc distribution, which as you point out allows you to use either server.

By the way, you can change the server locally, so you can test Production from your debug builds.

The documentation states:

At runtime, CloudKit uses your app’s com.apple.developer.icloud-container-environment entitlement to discover whether you are using a Development or Production version of your provisioning profile.

So you can add this to your entitlements to set it to Production or Development:

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

You could try setting this field to Development and then pushing to iTunes Connect, but I'm guessing that Xcode will overwrite it during the upload to force you to use Production.


It looks like this is not possible.

"Note that apps distributed via TestFlight or the store can’t use the development environment."https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/CloudKitQuickStart/TestingYourApp/TestingYourApp.html

However, you can point to Production while you're debugging the app through Xcode by setting: com.apple.developer.icloud-container-environment to "Production" in your entitlements file.


Actually you can follow this documentation and you use sandbox to test your app:

apple documentation