I have a weird situation here that I cant quite figure out the solution to. My app uses CoreData (CD) and I load the data base with a bunch of data the first time the app launches. Thats all been working fine with no issues.
Heres the problem: I have decided to implement CloudKit so data is synced across devices. This works fine with one exception, heres the scenario where things are failing:
The user has 2 devices an iPhone and iPad they want to run my app on:
So they install the app on their iPhone and when the app runs its checks if the local CD database has records. If not, it loads the Hymns.json file (which is a bunch of static hymns) and this data is then put in the cloud.
Now the user loads the app on a new device( their iPad ). When the app runs the local (on device) CD database will be empty, so it will then load the Hymns.json file to the local (on device) database. At this point the data is duplicated.
Does anyone know if there is a way to check the cloud first to see if there is data stored their before loading data from the JSON file to their local (on Device) CD database?
I would appreciate any advice y'all have. Or if you encountered this type of situation before how did you solve it?
Thanks