I am trying to test CloudKit for sync, and am testing with the Xcode (15.4) SwiftUI templates (CoreData and SwiftData variants) and also with the CKSyncEngine sample-cloudkit-sync-engine example.
I am then testing sync by running app in my MacBook and my iPhone. Generally sync is working, but the behavior is very different when syncing changes from macOS -> iOS compared to from iOS -> macOS:
I open app on by my MacBook and iPhone
I add item on my MacBook, it shows up a second later on iPhone
On the other hand, if I add item on my iPhone it never shows up on my MacBook until I send app to background and then bring back to foreground.
Is this known/expected behavior? Any way to fix?
I assume this is a CKSyncEngine issue since the behavior is the same across all the different app setups and I think they all have CKSyncEngine in common.
For the sample-cloudkit-sync-engine example I have also tried calling try await self.database.syncEngine.fetchChanges(.init(scope: .all)) on the mac, but that doesn't seem to help. I still need to put app into background and then bring back to foreground before it will show changes.
I would expect changes to show up in my Mac UI without having to send app to background.
Topic:
App & System Services
SubTopic:
iCloud & Data