I installed the TestFlight version of my app and apparently that nuked CoreData + CloudKit. Help me understand this

Okay so I have a CloudKit backed CoreData model. I've been building in development for several months. I have a lot of data stored in the app on the development CloudKit.

Then I installed the TestFlight version on that device. It is now missing a lot of data that used to be on that device. And it won't sync with my other apps.

I assume this is because of the production vs development thing..

But even when I install the app via Xcode, syncing is broken. Its not updating and I'm just getting this error:

I'm really worried about this and am totally reliant on CloudKit working. But now such simple thing broke syncing and I'm not sure how to get it back up and running

CoreData: debug: CoreData+CloudKit: -[PFCloudKitSerializer applyUpdatedRecords:deletedRecordIDs:toStore:inManagedObjectContext:onlyUpdatingAttributes:andRelationships:madeChanges:error:]_block_invoke(1021): Failed to find matching objectIDs for <CKRecordID: 0x2823541c0; recordName=BFE5B0E0-E4BC-4151-B64F-771AF271DE6C, zoneID=com.apple.coredata.cloudkit.zone:defaultOwner> / <CKRecordID: 0x2823542c0; recordName=B342EDDF-8F2A-4496-B5AB-BEF29AF4018C, zoneID=com.apple.coredata.cloudkit.zone:defaultOwner> in pending relationship: 0x9eebd60aabec84c2 <x-coredata://1DE90E1A-C7CF-4963-B10F-60142BFFCFD7/NSCKImportPendingRelationship/p11489>

Replies

When you run your CloudKit app via Xcode, on simulator or device, the container being used is 'development'. When ever I detect a change of deployment type (i.e. #if DEBUG), I **** my local core data database and let it rebuild from CloudKit. While you can replicate the data in both development and production containers, it probably won't be 'auto-magic' like you're hoping.

When you install the app via TestFlight, can you first delete your local app? I would assume this would get you past the synchronization error you've shared above.

Another thing to check is to make sure your schema is deployed. NOTE: Schema can only add fields, so once you deploy to production, you're stuck with them.