Initial sync of watchOS app using Core Data and CloudKit

I have an existing iOS/watchOS app that uses a third-party database and WatchConnectivity. For various reasons I am migrating the app to use Core Data with CloudKit.

I have everything working using NSPersistentCloudKitContainer. Sync between the iOS and watchOS app are working on my test devices when I start with an empty database.

However, I need to import existing user's data when they first install this new version. Some users may have hundreds or thousands of records, but the total database size is under 1-2MB.

Data migration/import is working on the iOS side, the Core Data entities are populated on first launch and uploaded to CloudKit (I see in the debug logs that a NSPersistentCloudKitContainer.Event export ends successfully).

The problem is launching the watchOS app does not sync the data from CloudKit. I see a import started event but never see it end. I never see any Core Data entities appear on watchOS even after waiting several minutes and re-opening the Watch app multiple times. New entities or modifications made on either app are also not synced.

Is the problem just too much data which causes the CloudKit sync to never finish?

What are the best practice to populate a watchOS app with initial data from the parent iOS app and keep it in sync with CoreData/CloudKit?

I confirmed that the issue is too much data to be synchronized.

If I trim my data set so there are only ~1k entities, the Watch app is able to sync all the data, and the time between CloudKit import start and end events is about ~10s.

When the number of entities on the order of ~10k, the Watch app CloudKit import never completes, even after leaving the app running (with debugger attached) for 15 minutes.

Is this limitation documented anywhere?

Check out this information. It may help you.

Please install the CloudKit logging profile, reproduce the issue on watchOS and file a bug report with the collected sysdiagnose so that we may investigate further.

Initial sync of watchOS app using Core Data and CloudKit
 
 
Q