Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyncError on macOS #173

Open
teawithfruit opened this issue Dec 28, 2021 · 1 comment
Open

SyncError on macOS #173

teawithfruit opened this issue Dec 28, 2021 · 1 comment

Comments

@teawithfruit
Copy link

I'm trying to implement an app with sync between iOS and macOS.
Now I'm at the pint where a notofication from CloudKit should trigger the sync. On iOS everything works fine, but not on macOS. If I start the sync process with synchronizer?.synchronize(completion: ((Error?) -> ()) I got a "CloudKitSynchronizer >> Initiating synchronization" print on the console and a following SyncError without any further information.

I think this error raises because of an empty zoneID in line 35 of the following code.

override func start() {
super.start()
let databaseChangesOperation = CKFetchDatabaseChangesOperation(previousServerChangeToken: databaseToken)
databaseChangesOperation.fetchAllChanges = true
databaseChangesOperation.recordZoneWithIDChangedBlock = { zoneID in
self.changedZoneIDs.append(zoneID)
}
databaseChangesOperation.recordZoneWithIDWasDeletedBlock = { zoneID in
self.deletedZoneIDs.append(zoneID)
}
databaseChangesOperation.fetchDatabaseChangesCompletionBlock = { serverChangeToken, moreComing, operationError in
if !moreComing {
if operationError == nil {
self.completion(serverChangeToken, self.changedZoneIDs, self.deletedZoneIDs)
}
self.finish(error: operationError)
}
}
internalOperation = databaseChangesOperation
database.add(databaseChangesOperation)
}

@mentrena it would be really cool if you could have a look at this.

@mentrena
Copy link
Owner

SyncError is an Int enum, do you know which case you're getting?

For reference:

@objc public enum SyncError: Int, Error {
        /**
         *  Received when synchronize is called while there was an ongoing synchronization.
         */
        case alreadySyncing = 0
        /**
         *  A synchronizer with a higer `compatibilityVersion` value uploaded changes to CloudKit, so those changes won't be imported here.
         *  This error can be detected to prompt the user to update the app to a newer version.
         */
        case higherModelVersionFound = 1
        /**
         *  A record fot the provided object was not found, so the object cannot be shared on CloudKit.
         */
        case recordNotFound = 2
        /**
         *  Synchronization was manually cancelled.
         */
        case cancelled = 3
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants