Search code examples
iosswiftswift2cloudkitnserror

Check / Compare NSError Code in CloudKit?


I guess it is basic, but still .. how can I check whether I get a ZoneBusy error?

if error.code == CKErrorCode.ZoneBusy { // <- compiler says can't use '==', then what?

enter image description here

Reference:

https://developer.apple.com/library/prerelease/ios/documentation/CloudKit/Reference/CloudKit_constants/index.html#//apple_ref/c/tdef/CKErrorCode


Solution

  • It appears that you are missing .rawValue.

    So it should be:

    CKErrorCode.ZoneBusy.rawValue