I have a Core Data app that will end up being an iPhone/iPad universal application.
I would like to implement cloud syncing so that an iPhone and an iPad both running the app could share data. I'm planning to use the recently released Dropbox API. Does anyone have any thoughts on the best way to go about doing this? The Dropbox API allows for apps to store files on the cloud. What I was thinking was to original store the database (sqlite) for the app on the cloud and then download that database, but I then realized that using that method would make it painfully difficult to merge changes (rather than replacing the whole database).
Any thoughts are appreciated. Thanks.
The Solution: iCloudOpen the Settings app on one device, tap your name to open the Apple ID screen, then select iCloud. Turn on the toggle switches next to every category of app and content that you want to sync between the iPhone and iPad. Repeat this process with the second device.
Go to Settings > [your name]. Tap Family Sharing. Tap iCloud+. Follow the steps to share your existing plan.
The first time you set up syncing, you must connect your device to your Mac using a USB or USB-C cable. After you connect the device, the device icon appears in the Finder sidebar and selecting the icon displays syncing options. You then select which items to sync.
If you can get away with it, the easiest way to do synchronization (by far) is to have three copies of your data locally: the copy you last uploaded ("old"), the copy produced by local changes ("mine") and the copy now downloaded from the server ("theirs").
Then, sort all the records in all three files and walk through them one by one:
Note that "mine" or "theirs" or "old" might not exist. The rules above still apply in that case; if the result you choose is "does not exist", then you'll want to delete the record in the output file.
Finally, upload the resulting file back to the server so that it will be the "theirs" database for the next guy. Then copy the new file to your local "old" and "mine" databases.
(There are more space-efficient algorithms than the above... but there aren't any easier ones :) And disk space is pretty cheap nowadays, particularly if you compress the files.)
You may want to use a different method for synchronization. What is the type of data that you will be dealing with?
I've had much success using a lightweight rails back-end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With