drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 131 forks source link

Allow user to choose between local and cloud data #144

Closed basebander closed 10 years ago

basebander commented 10 years ago

I'm curious how one would determine if there is ensembles data already existing in iCloud. I want to allow the user to choose between uploading the local data or using the data already existing in iCloud when enabling sync. Thank you.

drewmccormack commented 10 years ago

There is a class method in CDEPersistentStoreEnsemble which lists the ensemble identifiers in the cloud. You could use that.

Having said that, there is no foolproof way to do it, because iCloud transfers files asynchronously. You can never be 100% sure that someone hasn't added data on another device, and it hasn't arrived yet.

But I think that method would be good enough. Worst case is that the data would end up merged. No data loss.

Drew

basebander commented 10 years ago

Makes sense, thanks very much!