条件CKSubscription不会触发通知

时间:2014-08-03 17:22:13

标签: cloudkit cksubscription

我有一个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有什么问题?

1 个答案:

答案 0 :(得分:0)

subscriptionID字符串太长。

当你这样减少它时,它会起作用:

let ekf = "oup-\((organizationUser.recordID as NSString).substringToIndex(7))"