21
votes

Is it possible to submit an app to the new TestFlight via iTunes Connect using the "Development" environment for CloudKit?

It seems that only AdHoc Provisioning Profiles ask for the preferred CloudKit container name (Production or Development) when doing an "Export" from Organizer, however AdHoc Provisioning profiles do not contain the "beta-reports-active" entitlement required to submit apps to iTunes Connect and allow TestFlight use.

SO it would seem if you want to use the new iTunes Connect version of TestFlight to test your CloudKit-based app, you have to use the Production environment. Has anyone else had this issue?

3

3 Answers

22
votes

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.

5
votes

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.

0
votes

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

apple documentation