ioscore-datacloudkitnspersistentcloudkitcontainer

Data associated with iCloud account when switching from development to production


I'm about to switch my CloudKit schema from development to production before sending the app to TestFlight, but I'm confused about something.

I've been adding many records in Core Data while testing in development mode. Some are specifically crafted to look good in future marketing screenshots. They're successfully synced between devices thanks to NSPersistentCloudKitContainer. These records are associated with my iCloud account, with my Apple ID.

When I'll switch the schema to production, new beta testers (and, later, users) will create new records, stored in their private database in their own iCloud account, all is well.

But what will happen for me and my nicely crafted data?

In the simulator and my devices, I'll still be using the same iCloud account in production that I'm using in development. Does this mean I will keep my existing data? I thought deploying to production didn't copy records...

So, there's something I didn't understand, obviously, and I'd love an explanation to clear things up before I take the next step.


Solution

  • In short - your dev data will stay in development and you'll be starting 'fresh' when you launch your app installed from testflight.

    When you build to the simulator or build to your physical device from xcode during development, the default is to point to the development environment.

    When you build and submit to the app store - for testflight or for production release - the default is to point to production.

    This is even for the same iCloud account. One iCloud account can have both development and production data.

    So, testflight on your device for your iCloud account will point to production, but a local build to your device (same iCloud account) from xcode will point to development.

    And all your testflight users will be building data on production, so when you release 'for real' to the app store, the data created during testflight testing will still be there on production (unless of course you manually were to wipe it).

    You CAN point development builds to production or vice versa, but I'll consider that outside of the scope of this question for now!