24

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?

nh32rg
  • 1,462
  • 13
  • 15

3 Answers3

25

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.

Richard Venable
  • 8,310
  • 3
  • 49
  • 52
  • 1
    I did try the entitlements suggestion and uploaded to iTunes TestFlight, however the build had a badge on it indicating it could not be used. Thanks for the help though! – nh32rg Nov 18 '14 at 21:12
  • 1
    Great! Thanks! Works for me to switch to Prod environment with debug – AlKozin Dec 02 '14 at 10:24
  • That doesn't work for me. In my archived-expanded-entitlements.xcent I switch from com.apple.security.app-sandbox to com.apple.developer.icloud-container-environment Production and still pointing to SandBox – user2924482 Dec 08 '14 at 18:10
  • @user2924482 The app sandbox is different from the iCloud environment. App sandbox refers to the fact that your app can only access files that belong to it. All iOS apps are always sandboxed, no matter what. The iCloud environment has nothing to do with that - it refers to which server the app talks to: the development server or the production server. – Richard Venable Dec 08 '14 at 21:25
  • @RichardVenable, I do understand the app sadboxing is different the the iCloud/Cloudkit environment. My question was how can the same upbuild you can be switching from sandbox (icloud/cloudkit) environment to a production (icloud/cloudkit) environment? – user2924482 Dec 14 '14 at 04:14
  • @user2924482 I don't understand your question. I was pointing out that com.apple.security.app-sandbox has nothing to do with iCloud, so don't change that for this purpose. – Richard Venable Dec 14 '14 at 06:13
  • The only problem is that if you move to production and the record types need to be changed. Is that possible to change production environment with addition / removal of record types and fields and indexes ? Are there any limitations ? – user1046037 Mar 29 '18 at 18:18
  • 1
    You can only make additive changes to production. You cannot delete or rename things in production. But this is exactly what Apple wants before you use TestFlight. They don't want you shipping code to their customers that you break later. – Richard Venable Apr 02 '18 at 18:53
  • @RichardVenable Thanks a lot !!, I have a question about about CKError localizedDescription, could you have a look at it. Refer: Thanks a lot !!, I have a question about localizedDescription of CKError, could you help me with it. https://stackoverflow.com/questions/49856270/ckerror-localizeddescription – user1046037 Apr 17 '18 at 04:18
  • Not sure if this is my error, or something changed, but adding this key prevents my app from building: Automatic signing is unable to resolve an issue with the target's entitlements. Automatic signing can't add the com.apple.developer.icloud-container-environment entitlement to your provisioning profile. Switch to manual signing and resolve the issue by downloading a matching provisioning profile from the developer website. Alternatively, to continue using automatic signing, remove this entitlement from your entitlements file and its associated functionality from your code. – lewis Oct 17 '19 at 16:23
10

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.

thefaj
  • 905
  • 9
  • 11
  • 1
    Thank you; I didn't realize that I needed to switch to the Production environment even for _internal_ beta testing. – AmitaiB Apr 09 '17 at 01:49
-1

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

apple documentation

Jerrot
  • 318
  • 1
  • 13
user2924482
  • 8,380
  • 23
  • 89
  • 173
  • That link now redirects to an "archive" document, which says "Instruct [your testers] to install the app on their devices using iTunes", but iTunes no longer exists. – Graham Lea Jul 12 '23 at 00:59