iCloud syncing in Account Tracker
A lot of the support questions I receive are to do with database syncing in Account Tracker, and 99% these are to do with iCloud (Personal Sync) rather than Dropbox (Family Sync). This is not really surprising for two reasons: syncing is highly complex and iCloud itself is very buggy!
This post tries to explain some of the more common issues related to iCloud syncing in Account Tracker, together with workarounds where known.
First an iCloud overview …
iCloud is basically “cloud” based storage tied to a single iTunes account. Apps can use it to share data between all devices belonging to that user. It cannot be used to share data between different users and that is why I introduced Dropbox (Family Sync) – see the Alternatives to iCloud section below.
When an app writes a file to iCloud, the operating system (iOS) takes care of copying this to “the cloud” and from there to other devices. Apps have no control over how long this takes. Often it is seconds, but I have seen delays of many minutes, even up to an hour. On at least two occasions iCloud has been offline for days!
Basic things to check
You should check that you are running the latest versions of my app and of iOS itself. Apple have fixed MANY bugs in iCloud since the release of iOS 8.
To use iCloud, each device needs to be signed in and using the SAME iTunes account. This is done in the main Settings app, under iCloud.
And for iCloud to work, you clearly need network access, otherwise files can’t be copied between devices. This can either be WiFi, or you can control which apps can used cellular data in the main Settings app under Cellular. Note that devices don’t have to be on the same network. They just need access to the Internet.
Finally you need a few MB of free space on iCloud – you can check this in the main Settings app, under iCloud.
iCloud vs iCloud Drive?
With iOS 8 (and OS X Yosemite), Apple introduced iCloud Drive. A user can choose between iCloud and iCloud Drive, however once ANY SINGLE DEVICE moves to iCloud Drive (no matter which one, even your Mac), there is no going back. All of your files are migrated to iCloud Drive and access to iCloud will be blocked for all your other devices. This means that any device not able to run iOS 8 (e.g. the iPhone 4) will lose access to iCloud across all apps!
Basically it’s an all or nothing choice – either you stick to using iCloud everywhere or you move to iCloud Drive everywhere.
If you do want to migrate to iCloud Drive, you do this in the main Settings app, under iCloud. From there you can control which apps have access, and clearly Account Tracker needs to be selected.
Either way, both iCloud and iCloud Drive work the same as far as my app is concerned. Use of the term iCloud from now on can be assumed to mean both iCloud and iCloud Drive.
Exchanging backup files
The easiest way to test whether iCloud is working, is to exchange backup files between devices. In my app go to the Settings tab, make sure iCloud is enabled and go to the Backups screen. From there you can make a backup by selecting the Backup Now row. This will quickly create a new backup and add it to the top of the list of backups. The date and time is encoded in the file name.
Now go to your other device and run my app. Make sure iCloud is enabled in the settings and go to the Backups screen. You should see your new backup listed, if not periodically tap the refresh button at the top right. It can sometimes take a while to appear, but should do so eventually (within a few minutes for sure).
Next try making a backup in the other direction. On your second device choose Backup Now, see the new file appear and on your first device wait for it to appear there too.
If you can exchange backup files, syncing should “just work”.
Problems enabling syncing
The main issues around enabling syncing all relate to the time it takes for iOS to inform the app about new files appearing in iCloud.
Step 1 is where you enable syncing on your PRIMARY device. This copies a new sync file to iCloud.
Step 2 is where you enable syncing on your SECONDARY device. If it doesn’t give you the option of becoming SECONDARY, this is because the file in step 1 has not appeared on that device. It will do eventually, but you need to give it time (a few minutes).
Once enabled on your SECONDARY, step 3 is simply the SECONDARY waiting for an initial sync from your PRIMARY. Make sure my app is running on your PRIMARY device, and eventually you should see the “found a new SECONDARY device” popup. Again this can take a while (a few minutes).
Step 4 is simply you initiating the initial sync from PRIMARY to SECONDARY.
Finally step 5 is when the SECONDARY confirms the initial sync is complete. Again this can take a while (you guessed it, a few minutes).
In total this setup process involves writing 3 files to iCloud, and all the delays in copying them to “the cloud” and on to all devices. As a reminder I have no control over how long this takes. Having said that, the 5 step process usually takes less than a minute in total. But I have seen big delays (11 minutes for the popup to appear in step 4 for instance).
Syncing has stopped working?
Once syncing is enabled, changes are tracked and when you close the app (by pressing the Home button), that device’s sync file is updated. This eventually makes it to your other devices and you will see the Sync flag on the settings tab.
Sometimes it might appear as if syncing has stopped working. Often this is just iCloud being slow, however I am aware of one Apple issue that causes additional sync files (conflict copies) to be created. If this happens it will appear as if one device is not sending its changes to iCloud. You can see this in the sync log where it will say some number of sync files were “ignored”. The only way to recover from this is to disable syncing on all devices and set it up again, making sure you choose the device with your most up-to-date data as PRIMARY.
I have also seen issues where a particular device just fails to copy anything to iCloud. No errors are shown, the app has written the files but iOS fails to copy them. You can test this by making a new backup and seeing if that gets copied. The best way to recover from this iOS issue is simply to reboot/restart you device(s).
Finally, even this doesn’t always work. One user managed to get things up and running again by carefully backing up his data, exporting this off his device (e.g. by email), deleting and re-installing my app, then finally restoring the backup file. This process clearly resets something in iOS, but should be used with caution. In particular it is very important to know what you are doing with backup files. Don’t make a backup and then delete the app without making sure you have access to the backup file outside of the app itself (otherwise you will delete the backup file too, losing your data!).
Alternatives to iCloud
As you can tell from the above, the main issues I see with iCloud all relate to the time it takes iOS to copy data in the background. Also that the underlying implementation from Apple is buggy in ways I can’t predict or work around. While each iOS update fixes a few bugs, they also seem to introduce new problems too!
In August 2014 I added support for Dropbox (Family Sync), mainly to allow users with different iTunes accounts to exchange and share data. And because I am directly copying files to and from Dropbox myself, it is not only a lot faster but it is more reliable too.
Any user can use Family Sync if they prefer – you don’t need a family!