Detect/Receive CloudKit CoreData Errors

In development I've switched to NSPersistentCloudKitContainer and have begun the terrifying process of trying to test as many scenarios as possible to make sure nobody loses any data.

During some testing I saw an error like this:

<CKError 0x28033a310: "Partial Failure" (2/1011); "Failed to modify some records"; uuid = B6015357-50E0-40B3-949F-1557F59A23DB; container ID = "iCloud.com.xxxx.yyyyyy"; partial errors: {
F023EFDF-B9DE-4C17-872B-01C34C0DF129:(com.apple.coredata.cloudkit.zone:defaultOwner) = <CKError 0x280266fa0: "Invalid Arguments" (12/2006); server message = "Cannot create or modify field 'CD
someField' in record 'CDsomeRecord' in production schema"; uuid = B6015357-50E0-40B3-949F-1557F59A23DB>
... 399 "Batch Request Failed" CKError's omited ...
}>


I was able to fix this, but it was only affecting some scenarios and if this had happened to a real user they (and I) would never have known about the problem, and their data would not have synced to CloudKit.

If the store fails to load you get an error, but if it loads but doesn't sync you don't.

So my question is: is there a way to receive these kind of errors in code?

I have looked for notifications and delegate methods and I can't find any.

Did you found any solution to catch/handle CoreData+CloudKit errors?

Detect/Receive CloudKit CoreData Errors
 
 
Q