I’m working on an app that uses the new sharing support in NSPersistentCloudKitContainer
. I do not see a way to tell Core Data that an object, or set of objects, is no longer shared.
For example, if I create a set of objects and then call share(_:to:completion:)
, the objects are shared properly and moved to a new, custom CKRecordZone
, as expected.
Now, if the user stops sharing an object using UICloudSharingController
, the CKShare
that Core Data created is properly deleted from CloudKit, but the objects are still in the custom zone, and Core Data still has the original CKShare
associated with those objects. So, when I call fetchShares(matching:)
, I still get the CKShare
, but of course, that is no longer valid.
Forcing Core Data to fetch CloudKit changes by either moving the app to background and then foreground, or by stopping the app and relaunching does not cause Core Data to notice the change to the share.
Does anyone know how to tell Core Data that these objects are no longer shared?
Note, I’ve tried to do further testing, but iOS 15 beta 4 seems to have broken CloudKit, giving “Account temporarily unavailable due to bad or missing auth token” errors. See this post. Sigh, I’m stuck for now.