How to use
@ximlu Please check out @thillsman's project for an example (specifically look at KnapsackManager.swift). Also pay attention to what is getting logged with subsystem "com.ryanashcraft.CloudSyncSession"
I tried according to the configuration, but kept reporting errors. The following is the log of the project output
2023-09-27 10:43:37.727764+0800 Knapsack[1005:38787] [Sync Event] Start 2023-09-27 10:43:37.727913+0800 Knapsack[1005:38787] [Sync Event] Do work: Fetch 2023-09-27 10:43:37.727961+0800 Knapsack[1005:38787] [Sync Event] Do work: Create zone 2023-09-27 10:43:37.728002+0800 Knapsack[1005:38787] [Sync Event] Do work: Create subscription 2023-09-27 10:43:37.770861+0800 Knapsack[1005:38787] [Sync Event] Account status changed: Available 2023-09-27 10:43:41.090270+0800 Knapsack[1005:38787] Custom zone exists 2023-09-27 10:43:41.090747+0800 Knapsack[1005:38781] [Sync Event] Work success: Create zone 2023-09-27 10:43:43.196752+0800 Knapsack[1005:38789] [CK] Got a connection error for operation 884EF02AE430F6B5: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 969 named com.apple.cloudd was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid." UserInfo={NSDebugDescription=The connection to service with pid 969 named com.apple.cloudd was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.} 2023-09-27 10:43:43.202558+0800 Knapsack[1005:38782] Failed to check for subscription existence: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 969 named com.apple.cloudd was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid." UserInfo={NSDebugDescription=The connection to service with pid 969 named com.apple.cloudd was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.} 2023-09-27 10:43:43.204088+0800 Knapsack[1005:38789] [Sync Event] Halt
I created a
RecordType using my own account, and used the public_database as I wanted to check whether the data was successfully synced on the CloudKit dashboard. However, I have been receiving errors and am not quite sure where the problem lies. Here is a configuration:
static let storeIdentifier: String = "xxxxxxxxx"
static let zoneID: CKRecordZone.ID = .default
static let subscriptionID: String = ""
static let log: OSLog = .default
I can basically confirm that there is indeed a problem with the framework, and I can upload it using the original API
@ximlu I am not sure. I can tell you that this framework has been used in production for my app. There is likely something environmental causing issues. Are you testing this on a simulator or an actual device? The error seems to be underlying in the CloudKit framework itself, and CloudSyncSession is halting as a result.
Have you tried setting subscriptionID to something that's not empty string?
@ryanashcraft I am using real device for testing, and the system is iOS16+. Therefore, I really hope that you can provide a demo without any issues. I highly doubt the reliability of the demo you mentioned for self-use.