Setup:
I have a watch app that is not independent, but cooperates with the companion iOS app.
Both use CoreData + CloudKit, and the size of the data stored in iCloud is very little (a few hundred records, where each record has 0.5 kB).
The iOS app has no problems syncing CoreDate with iCloud.
Problem:
The watch app, however, is not able to download these few MB from iCloud after the app has been newly installed. Here is the log:
2022-08-18 11:21:47.373416+0200 Watch Extension[1000:1029376] [error] error: Unexpected background task assertion cancellation.
2022-08-18 11:21:47.375646+0200 Watch Extension[1000:1029376] [error] error: Unexpected background task assertion cancellation.
2022-08-18 11:21:47.375822+0200 Watch Extension[1000:1029376] [BackgroundTask] Background task still not ended after expiration handlers were called: <_UIBackgroundTaskInfo: 0x1761c370>: taskID = 45, taskName = CoreData: CloudKit Import, creationTime = 154599 (elapsed = 27). This app will likely be terminated by the system. Call UIApplication.endBackgroundTask(_:) to avoid this.
2022-08-18 11:21:47.381768+0200 Watch Extension[1000:1029376] [BackgroundTask] Background task still not ended after expiration handlers were called: <_UIBackgroundTaskInfo: 0x17525160>: taskID = 77, taskName = CoreData: CloudKit Export, creationTime = 154600 (elapsed = 26). This app will likely be terminated by the system. Call UIApplication.endBackgroundTask(_:) to avoid this.
2022-08-18 11:21:56.234513+0200 Watch Extension[1000:1029376] [BackgroundTask] Background Task 77 ("CoreData: CloudKit Export"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
2022-08-18 11:21:56.234681+0200 Watch Extension[1000:1029376] [BackgroundTask] Background Task 45 ("CoreData: CloudKit Import"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
Obviously, watchOS is not able to download a few MB in half a minute. Worse, the sync is cancelled, and it is unclear when it is continued. The result is that the watch shows incomplete data, a very bad user experience.
I read here that others have a similar problem with slow iCloud sync on watchOS, but there is no solution.
Questions:
What could be the reason for this very slow sync? Can I speed it up? Any other suggestions?