我有一个OUP
记录类型,它对.DeleteSelf
记录类型有一个OU
引用。
如果我只是设置无条件订阅,则有效:
let subscriptionOUP = CKSubscription(recordType: "OUP", predicate:NSPredicate(value: true), subscriptionID: "oup", options: .FiresOnRecordUpdate)
但条件方式不:
let ekf = "oup-\(ou.recordID)"
let pr = NSPredicate(format: "ou = %@", CKReference(recordID: CKRecordID(recordName: organizationUser.recordID), action: .DeleteSelf))
let subscriptionOUP = CKSubscription(recordType: "OUP", predicate:pr, subscriptionID: ekf, options: .FiresOnRecordUpdate)
println("\(pr) \(ekf)")
终端内容:
ou == <CKReference: 0x1558d3d0;51D56239-D68C-4E12-BD23-E4DCEF5721B7:(_defaultZone:__defaultOwner__)>
oup-51D56239-D68C-4E12-BD23-E4DCEF5721B7
我的谓词或订阅ID有什么问题?
答案 0 :(得分:0)
subscriptionID
字符串太长。
当你这样减少它时,它会起作用:
let ekf = "oup-\((organizationUser.recordID as NSString).substringToIndex(7))"