1

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

4

1 回答 1

0

subscriptionID字符串太长。

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

let ekf = "oup-\((organizationUser.recordID as NSString).substringToIndex(7))"
于 2014-08-04T06:42:20.197 回答