Post

Replies

Boosts

Views

Activity

Reply to NSPersistentCloudKitContainer: how to un-share objects?
I worked around this by always checking to see if the share actually exists in CloudKit, rather than relying on the existence of a CKShare from fetchShares(matching:). I get the URL from the CKShare returned from fetchShares(matching:) and call this: private func remoteShare(at url: URL) async throws -> CKShare? { do { let metadata = try await cloudKitContainer.shareMetadata(for: url) return metadata.share } catch let error as CKError { if error.retryable { throw RemoteError.retryable } else if error.userInterventionRequiredError { throw RemoteError.userInterventionRequired } else if error.code == .unknownItem { return nil } else { throw RemoteError.remoteFailure } } catch { throw RemoteError.remoteFailure } } } If I get unknownItem that means there is no share on the remote, so the object is not actually shared. The RemoteError is my custom error handling, and I have some extensions on CKError to categorize the errors. I hope this helps.
Oct ’21
Reply to NSPersistentCloudKitContainer: how to un-share objects?
I worked around this by always checking to see if the share actually exists in CloudKit, rather than relying on the existence of a CKShare from fetchShares(matching:). I get the URL from the CKShare returned from fetchShares(matching:) and call this: private func remoteShare(at url: URL) async throws -> CKShare? { do { let metadata = try await cloudKitContainer.shareMetadata(for: url) return metadata.share } catch let error as CKError { if error.retryable { throw RemoteError.retryable } else if error.userInterventionRequiredError { throw RemoteError.userInterventionRequired } else if error.code == .unknownItem { return nil } else { throw RemoteError.remoteFailure } } catch { throw RemoteError.remoteFailure } } } If I get unknownItem that means there is no share on the remote, so the object is not actually shared. The RemoteError is my custom error handling, and I have some extensions on CKError to categorize the errors. I hope this helps.
Replies
Boosts
Views
Activity
Oct ’21
Reply to UICloudSharingController is broken and needs Apple's attention
I have the same issue, which i posted about here: https://developer.apple.com/forums/thread/691268
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to NSPersistentCloudKitContainer support for CloudKit Record Zone Sharing
Can’t wait to try this out. Hopefully I can remove all my custom CloudKit code.
Replies
Boosts
Views
Activity
Jun ’21