Cloudkit is broken (sort of) in simulator

I am developing an app that uses NSPersistentCloudKitContainer.

I am seeing lots of inconsistency.

But....after a long time observing...I strongly believe the simulator implementation of cloudkit is broken.
  1. Log in via your icloud

  2. Open the built in Apple reminder app in both simulator and on your physical device.

  3. You will notice that changes made in simulator propagate reasonably well to the device....but any changes made on device don't propagate to the simulator reminders app...you need to force quit app on simulator for changes to reflect.

The ultimate example app is apple notes. It handles sync better than any other app out there.

I still am in the process of understanding why my app does not sync as well as notes, eg playing around with things like:

 container.viewContext.mergePolicy = NSMergeByPropertyStoreTrumpMergePolicy
    container.viewContext.automaticallyMergesChangesFromParent = true
  NotificationCenter.default.addObserver(self,
    selector: #selector(storeRemoteChangeNotification),
    name: NSNotification.Name(rawValue: "NSPersistentStoreRemoteChangeNotification"),
    object: CoreDataHub.getContainer().persistentStoreCoordinator)

But, for sure, this simulator bug threw me off.

After this....I compiled my app as a mac app, and I have another, more reliable way to test cloudkit sync.

I wish the Apple Notes app was open sourced....it seems to things very well and we could all learn a lot from it.

Any tips/advice would be appreciated. Thank you

Most pressing, is what api calls is the Notes app using to get an activity indicator that icloud is syncing?
Cloudkit is broken (sort of) in simulator
 
 
Q