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

时间:2015-07-15 22:42:01

标签: ios swift swift2 cloudkit nserror

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

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

enter image description here

参考:

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

1 个答案:

答案 0 :(得分:6)

您似乎缺少.rawValue

所以它应该是:

CKErrorCode.ZoneBusy.rawValue