检查/比较CloudKit中的NSError代码?

Ján*_*nos 3 nserror ios swift cloudkit swift2

我想这是基本的,但仍然..我怎么能检查我是否收到ZoneBusy错误?

if error.code == CKErrorCode.ZoneBusy { // <- compiler says can't use '==', then what?
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

参考:

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

Unh*_*lig 6

看来你错过了.rawValue.

所以它应该是:

CKErrorCode.ZoneBusy.rawValue