CloudKit CKErrors: Raw values and case names

While troubleshooting CloudKit bugs, I came across the excellent post General Findings about NSPersistentCloudKitContainer. I followed their lead and added an observer to NSPersistentCloudKitContainer, and was able to log a lot (a LOT) of CKErrors, but somehow only caught the raw Int values and not the case names.

Raw value Case name Cause
1 internalError A nonrecoverable error that CloudKit encounters.
2 partialFailure An operation completed with partial failures.
3 networkUnavailable The network is unavailable.
4 networkFailure A network is available, but CloudKit is inaccessible.
5 badContainer You used an unknown or unauthorized container.
6 serviceUnavailable CloudKit is unavailable.
7 requestRateLimited CloudKit is rate-limiting requests.
8 missingEntitlement The app is missing a required entitlement.
9 notAuthenticated The user is unauthenticated.
10 permissionFailure The user doesn’t have permission to save or fetch data.
11 unknownItem The specified record doesn’t exist.
12 invalidArguments The request contains invalid information.
13 resultsTruncated (Deprecated) CloudKit truncated a query’s results.
14 serverRecordChanged CloudKit rejected a record because the server’s version is different.
15 serverRejectedRequest CloudKit rejected the request.
16 assetFileNotFound The system can’t find the specified asset.
17 assetFileModified The system modified an asset while saving it.
18 incompatibleVersion The current app version is older than the oldest allowed version.
19 constraintViolation The server rejected the request because of a unique constraint violation.
20 operationCancelled An operation cancelled.
21 changeTokenExpired The change token expired.
22 batchRequestFailed The system rejected the entire batch of changes.
23 zoneBusy The server is too busy to handle the record zone operation.
24 badDatabase The operation can’t complete for the specified database.
25 quotaExceeded Saving a record exceeded the user’s storage quota.
26 zoneNotFound The specified record zone doesn’t exist.
27 limitExceeded The request’s size exceeds the limit.
28 userDeletedZone The user deleted a record zone using the Settings app.
29 tooManyParticipants A share has too many participants.
30 alreadyShared CloudKit attempted to share a record with an existing share.
31 referenceViolation CloudKit can’t find the target of a reference.
32 managedAccountRestricted CloudKit rejected a request due to a managed-account restriction.
33 participantMayNeedVerification The user isn’t a participant of the share.
34 serverResponseLost CloudKit is unable to maintain the network connection and provide a response.
35 assetNotAvailable The system can’t access the specified asset.
36 accountTemporarilyUnavailable The user’s iCloud account is temporarily unavailable.
Ben Fox @fox