How to provide visual feedback about iCloud sync status when the user reinstalls an app?

It takes a few seconds, sometimes a few minutes for records to be downloaded back from CloudKit when the user reinstalls the app, which leads users to thinking their data was lost. I would like to know if there’s any way to provide a visual feedback about the current CloudKit sync status so I can let users know their data is being in fact downloaded back to their devices.

Answered by DTS Engineer in 831056022

Yeah, if you are using NSPersistentCloudKitContainer, NSPersistentCloudKitContainer.Event is the API that provides you the activity status.

If you are using the CloudKit framework, a CloudKit operation triggers its completion handler, and so you can get the status from there.

Note that the status you get from the mentioned APIs doesn't tell whether your local cache is synchronized with the server or not, because it is perfectly possible that a new change has been made on the server version immediately before you get notified that an activity / operation is completed.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

I use https://github.com/ggruen/CloudKitSyncMonitor for a similar use case and it works quite well for me.

Yeah, if you are using NSPersistentCloudKitContainer, NSPersistentCloudKitContainer.Event is the API that provides you the activity status.

If you are using the CloudKit framework, a CloudKit operation triggers its completion handler, and so you can get the status from there.

Note that the status you get from the mentioned APIs doesn't tell whether your local cache is synchronized with the server or not, because it is perfectly possible that a new change has been made on the server version immediately before you get notified that an activity / operation is completed.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

How to provide visual feedback about iCloud sync status when the user reinstalls an app?
 
 
Q