CloudSyncSession icon indicating copy to clipboard operation
CloudSyncSession copied to clipboard

How to use

Open ximlu opened this issue 2 years ago • 6 comments

image I have followed the documentation to use it in my project, but the callback has not been captured. I'm not sure if it's a bug or an issue with my implementation. It would be great if there is a demo on how to upload and download data.

ximlu avatar Sep 26 '23 15:09 ximlu

@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"

ryanashcraft avatar Sep 26 '23 22:09 ryanashcraft

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

ximlu avatar Sep 27 '23 02:09 ximlu

image 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

ximlu avatar Sep 27 '23 02:09 ximlu

I can basically confirm that there is indeed a problem with the framework, and I can upload it using the original API

ximlu avatar Sep 27 '23 13:09 ximlu

@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 avatar Sep 27 '23 18:09 ryanashcraft

@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.

ximlu avatar Sep 28 '23 01:09 ximlu