Reputation: 1595
I'm updating a local Core Data-driven app to support iCloud. One challenge I anticipate is around what I'm calling "stock objects" -- seed data the app provides at first launch that 99% of users will customize.
Stock Objects
Item A
Item B
Customized Objects
Tomatoes
Potatoes
If the user then launches the app for the first time on a new device, I think the default behavior would be for the re-creation of the stock objects which would get merged with the customized objects from the iCloud persistent store (Item A, Item B, Tomatoes, Potatoes), resulting in a messy user experience.
One approach might be to check for iCloud data synchronously at first launch, and if it exists, not create the stock objects. But still, the user could be offline on first launch, and then on second launch, the same undesirable merge of local stock objects with iCloud custom objects would happen.
Are there ways to add logic to iCloud merges, so that the arrival of customized objects from the cloud (Tomatoes and Potatoes) can signal me to delete local stock objects (Item A and Item B) before they get beamed up?
Thanks!
Upvotes: 2
Views: 523
Reputation: 1595
I'm not sure if this is the best approach, but this is what I'm doing:
Upvotes: 0
Reputation: 80271
Why don't you just avoid this by not providing seed objects? Simply prompt the user through the UI to enter his own objects on first launch. Ask, if she has used the app before and explain that it might pay to wait to sync from iCloud before recreating the objects.
Upvotes: 0