NSPersistentCloudKitContainer stops syncing

I have moved my NSPersistentContainer in my app to an NSPersistentCloudKitContainer to sync data between devices (iPhone, iPad, and Apple Watch supported). Sync works just fine in test & production, but after a few days it will stop working and behave as if each device is using local storage. This continues to happen until I reinstall the app and it syncs again, but only for a short time until it goes back to using local storage again. Does anyone know of a way to debug this?

I experienced similar behaviour. Could track it down to the device not getting the notification for updates.

Restarting helped for my iPhone, but not for my iPad. A few days later everything was back to normal for me.

Would be great to better reset or debug that kind of behaviour.
Ideally you'd file a bug report with a sysdiagnose from both / all the effected devices. Then we can take a look to make sure the changes a propagating correctly, push notifications aren't being lost, etc.
I noticed that when using the Simulator if you turn Wi-Fi off then do a context save you see lots of output including 12 instances of "The Internet connection appears to be offline." but if you turn Wi-Fi back on and then after a context save it never tries to sync again, even if you suspend and resume the app which is how you can usually trigger a sync on the Simulator.

Perhaps your problem is also caused by the device losing its network connection and syncing getting stuck?

Xcode Version 12.0 beta 3 (12A8169g)
iPhone SE (2nd generation) iOS 14.0 (18A5332e)
NSPersistentCloudKitContainer stops syncing
 
 
Q