paulw11 / Seam3

Cloudkit based persistent store for Core Data
Other
209 stars 25 forks source link

How to pre-populate data without getting duplicates on CK? #66

Closed daviddelmonte closed 6 years ago

daviddelmonte commented 6 years ago

Hi all, I wonder if anyone has run into this dilemma: When a user runs my app for the first time on a new device, I want to populate some data to the phone and to CloudKit. However, when the same user runs the app for the first time on a second device -- the pre-populated data is duplicated on CloudKit.

I'll keep pulling hair, but if anyone has encountered and solved this, I'd be most grateful to know how.

Thanks!

daviddelmonte commented 6 years ago

There’s likely a better way to do this. What I have done is to create a flag that is stored in iCloud, that is set after the first successful sync. If set, I don’t preload supply data.