In my app (Tap Forms Organizer), I store database changes in a separate encrypted SQCipher database file and upload that to iCloud. So the data going to iCloud is encrypted. Each file I upload has a sequence number in the file name so that Tap Forms can keep track of the correct order of operations and which file has already been processed. I store that information in a device registration file which I also sync. Basically it’s just a plist file that contains the device name, icon, and some counters so each device can keep track of which sync file it has already processed from each other device.
The trouble with my implementation is that there’s no baseline file that I can roll up all the transactions into so if you have 3 devices that you’ve restored the same data to and then synced that, Tap Forms will upload each database to iCloud. So essentially it would take up space for 3 copies of the data, one from each device. I haven’t figured out a good way to amalgamate all the sync files into a single baseline to reduce the amount of iCloud storage required. I just can’t see an iPhone having to process a bunch of multi-megabyte files to combine them into a single file.
This can also cause the number of sync files to just grow and grow forever consuming space. So I’ve provided a Reset iCloud Sync button the user can press which will clear out all these sync files. Then the next time they upload to iCloud, a new sync file with all the data will be uploaded to iCloud.
So ya… “man, there’s got to be a better way to do this.”
I’m currently in the process of adding Dropbox sync to Tap Forms using the basic same techniques I described here. I’m currently finding it syncs MUCH faster than iCloud Drive does.
I’d love to hear how others are doing this or if you have suggestions of a better way to do this.