I'm looking for a solution for the next situation: My app uses CoreData with CloudKit mirroring (via NSPersistentCloudKitContainer). In the latest version of my app I made some changes in db schema and created heavyweight core data migration for it. After this migration finishes, I see lots of duplicates for my entities. I think that CloudKit sees migrated container as a completely new one and just tries to download everything from iCloud again.
So generally the question is: should I clean my old CloudKit container somehow and just copy all the data from the new, migrated local one, or there is another solution, how to update cloud kit data with new migrated entities?
I'm sorry, if this question is stupid, I'm new to cloud kit and used it in totally auto mode, by just replacing NSPersistentContainer with NSPersistentCloudKitContainer (please, see the code here - https://gist.github.com/eiskrenkov/228c6ecb5c1b78ba360838114a7d0911 ), but now this issue happened. Any help, or chunk of code will be great, thank you!
So generally the question is: should I clean my old CloudKit container somehow and just copy all the data from the new, migrated local one, or there is another solution, how to update cloud kit data with new migrated entities?
I'm sorry, if this question is stupid, I'm new to cloud kit and used it in totally auto mode, by just replacing NSPersistentContainer with NSPersistentCloudKitContainer (please, see the code here - https://gist.github.com/eiskrenkov/228c6ecb5c1b78ba360838114a7d0911 ), but now this issue happened. Any help, or chunk of code will be great, thank you!