ICloud + Core Data - When Do You Need to Know to Sow iCloud Data Warehouse?

I am working on implementing iCloud data synchronization in my iPhone app. I am working on a user workflow, and the problem I am facing is trying to figure out when my application should “sow” data in iCloud. This can happen in two cases: (1) When the application is installed first, and I want to sow some preloaded data, or (2) if a previously existing client downloads an iCloud update and their existing data must be downloaded to iCloud. In each of these cases, I will have a "seed store" in the application, which I will read and upload data to iCloud.

The problem is, how do you know if the data has already been seeded? One option is to remove the seed store from the device after sowing is complete, so the next time the application starts, it will know that it does not need seed again.

But what if the store was already seeded from another device? Is there some kind of flag that I can check in iCloud that will tell me that the data should not be seeded? Or am I forced to always sow data when the local seed store is preserved, and then tricked? This will cause problems because the seed source data (starting from the initial launch of the application after installation) will be deleted by the user, so if they (1) install the application on their iPhone and then delete the default data set, and then (2) install the application on iPad, then the default dataset will be loaded again.

Another option that just occurred to me is that when a user installs an application or turns on iCloud, I can ask the user: have you downloaded the data yet? Do you want to replace any data in iCloud with local data? And if they say yes, then it will store the data in iCloud, and then reseed the local data. The problem with this, however, is that it creates the possibility of user error, and this is what I do not want users to hang.

Any thoughts?

+6
source share

Source: https://habr.com/ru/post/921620/


All Articles