All live CloudKit user data in Developement environment

Hi all,


We are getting issue reports from user that CloudKit isn't working for them and in our investigation to find what the issue is, we noticed that in the CloudKit Dashboard there are no records in the Production environment but that there are a lot (half a million at least) records in the Development environment. How is that possible, the AppStore rejects builds that target Developement, right? Is there a way of correcting this?


Regards,

Maurice

Replies

Was your app uploaded before or after August 20, 2015?


Prior to that date, there was an issue for apps that use the CloudKit container environment set to Development instead of Production; the issue was caused by a missing validation in iTunes Connect for apps not built and uploaded with Xcode, or where “Development” was inadvertently selected when exporting the archive from Xcode.


The missing validation was corrected on August 20, and apps uploaded after that date would not pass validation until they were updated to add the “Production” value to the "com.apple.developer.icloud-container-environment” entitlement (or to add that entitlement if it missing completely).

The current impact on your users depends on what your app does with CloudKit:

  • If the app uses CloudKit to get a stable user identifier, there should be no impact to your app: the identifiers for a given user are identical between Production and Development containers, so it will remain unchanged after updating the entitlement.
  • If the app only reads data from the public database, it will need to replicate the state of the public database between the Development and Production containers. The complexity of doing this depends on the size of data, how often it is updated and the tools you use to update the database. This process will be unique to your situation and setup.
  • If the app uses private databases and stores user data there, fixing the entitlement will behave as if the user database was empty. Depending on how the app handles such behavior, this might result in users losing data (if there’s no local cache or the “truth” is aways stored in CloudKit rather than locally) or it might be transparent (if the “truth” is the local data and the app pushes its local state to CloudKit).


Fixing the issue requires either selecting “Production” during the Export step from Xcode; or changing the entry in your app’s .entitlement file to “Production” instead of “Development”, or adding the entire entitlement key and value if it is missing:


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


If your app was uploaded after August 20, or your app has the CloudKit container set to Production already, or if you have any questions about this issue, please contact Developer Technical Support.