Nothing in life is ever simple and neither was this.
Of course things didn’t go *exactly* as planned. The one scenario I didn’t see happened to some folks.
It goes like this
1) launch iPhone app which moves all items to DB
2) launch iPad app which *also* moves all items to DB, before the iCloud sync has happened
3) iCloud syncs already migrated items from iPhone to iPad app, although items have same UUIDs they are different objects in Core Data (i.e. my dupe check when adding doesn’t apply)
4) now we have duplicates
The duplicates are particularly bad as my app is really expecting there to only be one item for each UUID. Now on to deduplicating them on users’ devices.
https://infosec.exchange/@pasi/114862129225905595
Pasi Salenius (@pasi@infosec.exchange)
Say we have two devices that have data in iCloud key-value storage. On app update we want to migrate that to iCloud synced Core Data database. Once the migration is done we mark a bool pref flag. How do we ensure that the following doesn’t happen? 1) iPhone app is first updated and copies KVS data to Core Data 2) iPad app is updated next, copies the same data from KVS to Core Data 3) iPad app syncs items to iCloud, iPhone copies them over and has duplicate items