我正在尝试通过使用OrPredicateType分配其谓词来创建CKSubscription。虽然可以使用AndPredicateType保存CKSubscriptions,但我无法使用' OR'来保存订阅。谓语。有没有人遇到过类似的问题? 这是我的代码:
let aName = "John"
let anotherName = "Jane"
let aNamePredicate = NSPredicate(format: "name = %@", aName)
let anotherNamePredicate = NSPredicate(format: "name = %@", anotherName)
let namePredicates = NSCompoundPredicate(orPredicateWithSubpredicates: [aNamePredicate, anotherNamePredicate])
let aSubscription = CKSubscription(recordType: "Employee", predicate: namePredicates, subscriptionID: "nameSubscription", options: [.FiresOnRecordCreation, .FiresOnRecordUpdate, .FiresOnRecordDeletion])
我收到此错误:
无法修改某些订阅error.code = 2错误!.description =< CKError 0x7fe7ce060740:"部分失败" (一千〇一十一分之二); "无法修改某些订阅&#34 ;;部分错误:{aSubscription =< CKError 0x7fe7cbc0e5e0:"无效参数" (一千〇九分之一十二); "意外的表达:name ==" John"或者姓名=="简""> }>