I'm developing an app based around Ensembes 2 with a CloudKit backend.
I'm using a custom zone on the private database in the Development environment. I have not yet deployed anything to Production.
My share is created at the same time as I create the root node, so I always instantiate UICloudSharingController via initWithShare:
I always fetch the share before passing it to initWithShare: to ensure it is up-to-date.
Generally speaking, everything works fine. I can create the zone, store my records, share my root record with another user via UICloudSharingController, and everything works well.
Just occasionally though, after inviting the first participant, the share will fail to save. My delegate will be called at
- (void)cloudSharingController:(UICloudSharingController *)csc failedToSaveShareWithError:(NSError *)error
and the error will be in the form
(lldb) po error
Error Domain=_UIShareErrorDomain Code=0 "(null)" UserInfo={NSUnderlyingError=0x1c0450aa0 {Error Domain=CKErrorDomain Code=2 "CKInternalErrorDomain: 1011" UserInfo={NSLocalizedDescription=Failed to modify some records, CKErrorDescription=Failed to modify some records, NSDebugDescription=CKInternalErrorDomain: 1011, CKPartialErrors=
{ "<CKRecordID: 0x1c04205a0; recordName=NietDevStore, zoneID=NietDevStore:__defaultOwner__>" = "<CKError 0x1c0445df0: \"Internal Error\" (1/5000); \"Public sharing identity on share <CKRecordID: 0x103d87f20; recordName=NietDevStore, zoneID=NietDevStore:__defaultOwner__> is different. Expected <30250201 01042074 9fb8536a a518fa2f 10c08cb9 ebe58b6e 1bbfcc39 97401b54 7691763c b92501>, got <30250201 010420f7 d5cd0d95 e66f7c6b d4e6cad8 7247291d 110e1c2f fd7832ec 19ed2f44 e59357>\">"; }
, NSUnderlyingError=0x1c044f840 {Error Domain=CKInternalErrorDomain Code=1011 "Failed to modify some records" UserInfo={CKErrorDescription=Failed to modify some records, NSLocalizedDescription=Failed to modify some records, CKPartialErrors={
"<CKRecordID: 0x1c0227f40; recordName=NietDevStore, zoneID=NietDevStore:_defaultOwner>" = "<CKError 0x1c044fbd0: \"Internal Error\" (1/5000); \"Public sharing identity on share <CKRecordID: 0x103d87f20; recordName=NietDevStore, zoneID=NietDevStore:defaultOwner_> is different. Expected <30250201 01042074 9fb8536a a518fa2f 10c08cb9 ebe58b6e 1bbfcc39 97401b54 7691763c b92501>, got <30250201 010420f7 d5cd0d95 e66f7c6b d4e6cad8 7247291d 110e1c2f fd7832ec 19ed2f44 e59357>\">";
}}}}}}
Conditions under which this occurs:
I have two devices and two iCloud accounts. I keep device A on account A, and device B on account B.
I will frequently delete my iCloud custom zone, uninstall and reinstall the app.
The bug occurs - rarely following this - i.e. the first time I attempt to share the zone during the lifetime of that install.
When the bug occurs on device A/account A, device B/account B will still be able to successfully create a share back to A, using the same zone name.
Conditions under which the bug persists
One the bug has triggered, I am only able to clear it by
- changing the custom zone name, or
- signing out of iCloud and logging back in (only tested this once), or
- attempting the same operation (creating the share) with the same code, on the same account, but on a different device (only tested this once)
The following actions appear to have no effect on the bug
- clean reinstall
- device reboot
- deletion of the zone as verified by checking via iCloud dashboard
- reset of developer environment via iCloud dashboard
- Turning iCloud drive on/off for that app