The setup:
My app uses CoreData+CloudKit to mirror iCloud content.
I am implementing record zone sharing and am testing it using 2 iPhones.
iPhone 1 executes the app standalone, iPhone 2 under Xcode control.
When iPhone 1 user invites iPhone 2 user to share his records, iPhone 2 user can accept the share.
This mirrors as expected the iCloud records to the shared database.
The problem:
During mirroring, I get several times the log:
[error] fault: Illegal attempt to work with the core-data or default zone
in the shared database: <NSSQLCore: 0x105907720>
(URL: file:///var/mobile/Containers/Data/Application/
66941553-40FC-4180-928C-BDF85D44AE84/Library/Application%20Support/Shared)
I have no idea what is illegal, nor what consequences this illegal attempt has.
Any ideas?
EDIT 1:
When I enable run time breakpoints, the app stops in:
Thread 17 Queue : NSManagedObjectContext 0x283f73b50 (serial)
at:
+[NSCKRecordZoneMetadata zoneMetadataForZoneID:inDatabaseWithScope:forStore:inContext:error:]
So it seems that the metadata of the iCloud shared database zone that is used for mirroring cannot be read.
EDIT 2:
One more observation, if zone sharing is active and I lookup my iCloud container in the Dashboard:
If I select Zones, and there the Shared Database, the shared zone com.apple.coredata.cloudkit.zone of type REGULAR_CUSTOM_ZONE is displayed. If I tap on the zone name, the Zone Details should be displayed.
Instead I get the error
„BadRequestException: endpoint not applicable in the database type 'sharedb‘“.
This seems to me to be the same error that I get in my app.
By now I believe this error can be ignored.
My app uses CoreData+CloudKit mirroring for the private and the shared databases.
It now monitors
NSPersistentCloudKitContainer.eventChangedNotificationand logs events as follows:A sample log (only the relevant parts) looks like this:
This indicates to me that the errors were created by an import event from the shared database.
There are 4 consecutive errors of the same type (Illegal attempt to work with the core-data or default zone in the shared database) but then the import is finished without error. It seems that the importer retries the import several times until it succeeds.
I am afraid we cannot do anything about it except to ask Apple not to log such errors…