ARTICLE AD BOX
I'm currently releasing an app that uses CloudKit to sync Core Data across multiple devices. However, I needed to make some changes to the Core Data model, so I performed a migration. This worked fine, and I was able to migrate successfully on one device. The changes were as follows:
Adding a new Attribute
Change the Type of an existing Attribute
Renaming an existing Relationship
The problem I'm facing now is the duplication of data that occurs when syncing between devices. There is duplication between the old version of the data (before migration) and the new version of the data (after migration). I have been researching this issue on the following websites, but I haven't been able to find a solution yet.
CoreData with CloudKit: After model migration everything is duplicated
https://www.atomicbird.com/blog/icloud-complications-part-2/?utm_source=chatgpt.com
Currently, my Core Data model does not have a UUID Attribute. Instead, it contains an Attribute called order, which is of type Int and was originally unique. However, after syncing, duplicate values occur, so I considered using it for deduplication.
However, this alone does not clarify whether the older version or the newer version of the data will be deleted during sync.
I’m also concerned that syncing may not work properly if different items are deleted on multiple devices.
If anyone has any tips or suggestions, I’d really appreciate it. Thanks.
