I am debugging a CloudKit sharing issue in an iOS app that uses NSPersistentCloudKitContainer with Core Data backed sharing. The symptom is that collaboration/share creation appears to succeed locally, but the resulting CKShare never gets a server-backed URL. UICloudSharingController therefore cannot proceed because share.url remains nil. (I do see the UICloudSharingcontroller Dialog and am abble to select people to share, one executed the share icon in the message window just spins
After adding extensive logging, it looks like the real problem is not the sharing UI itself, but that Core Data + CloudKit mirroring is already in a bad state before share presentation begins.
What I am seeing:
- Repeated CloudKit import failures with CKError.partialFailure
- The partial failure always contains one stale share zone with: • CKError.zoneNotFound • server message: "Zone does not exist"
- Core Data then repeatedly logs: • NSCloudKitMirroringDelegateWillResetSyncNotificationName • reason: ZoneDeleted • followed by a full mirroring reset
- Only after that reset loop do I attempt to prepare the collaboration share
- fetchShare(object:) returns a share record named cloudkit.zoneshare
- participants is 1
- but share.url remains nil forever, even after polling for ~20 attempts / ~20+ seconds
Representative log sequence:
CoreData+CloudKit ... Fetch finished with error: <CKError ... "Partial Failure"... partial errors: { com.apple.coredata.cloudkit.share.33781809-778A-461C-ABAB-872746C8F80D:defaultOwner = <CKError ... "Zone Not Found" (26/2036); server message = "Zone does not exist"> }>
NSCloudKitMirroringDelegateWillResetSyncNotificationName reason: 'ZoneDeleted' NSCloudKitMirroringDelegateDidResetSyncNotificationName reason: 'ZoneDeleted'
Preparing collaboration share for cruise 'Share 658' Fetching existing collaboration share for cruise 'Share 658' Fetch existing collaboration share result: found record='cloudkit.zoneshare' url='nil' participants='1'
You cannot get the URL of a share until it's been saved to the server Collaboration share URL polling attempt 1/20 ... ... Collaboration share URL polling attempt 20/20 ... Collaboration share 'cloudkit.zoneshare' never produced a URL
Important detail: This stale-zone Zone Not Found / ZoneDeleted reset cycle happens before the collaboration flow starts, so it looks like sharing is running inside an already unhealthy mirroring state rather than causing the corruption itself.
Questions:
-
Is this a known failure mode where a deleted/stale Core Data CloudKit share zone can keep the mirroring delegate in a reset loop and prevent newly fetched/created CKShare objects from ever receiving a server URL?
-
Is there an Apple-recommended way to recover from this in development besides deleting the app / resetting local data / clearing CloudKit development data?
-
Is there any supported way to identify and purge stale share metadata or orphaned Core Data share zones without fully resetting the local store?
-
If fetchShare returns a CKShare whose record exists locally as cloudkit.zoneshare but url stays nil, does that generally mean the share was never fully saved to the server, or can mirroring-reset churn itself prevent the URL from materializing?
Environment: • iOS app • Core Data + NSPersistentCloudKitContainer • CloudKit sharing enabled • issue observed in development environment
At this point my working theory is: • stale/deleted share zone in CloudKit development environment • NSPersistentCloudKitContainer import repeatedly hits zoneNotFound • mirroring resets continuously • collaboration share can be fetched locally but never becomes server-backed enough to produce share.url
If anyone from Apple or anyone who has hit this exact ZoneDeleted reset loop has guidance on the correct recovery path, I’d appreciate it.