I want to print some logs in the production environment. I just randomly found a callback function and wanted to use it to print logs, but I found that data synchronization actually started working! What the hell is Apple doing? Why? I think this is indeed a bug in CloudKit.I think this is indeed a bug in CloudKit. In the development environment, whether there is the code for printing logs or not, data can be synchronized normally.
var body: some Scene {
WindowGroup {
MainView()
.frame(minWidth: 640, minHeight: 480)
.environment(mainViewModel)
.onAppear {
printLog("MainView appear")
CKContainer.default().privateCloudDatabase.fetchDatabaseChanges(since: nil) { result in
switch result {
case .success(let success):
printLog("fetchDatabaseChanges success")
case .failure(let failure):
printLog(failure.localizedDescription)
}
}
}
}
.modelContainer(for: [NoteRecord.self], inMemory: isInMemory)
}
Post
Replies
Boosts
Views
Activity
I think, The default configuration of SwiftData and CloudKit meets your needs