1

I have a OUP record type, and it has a .DeleteSelf reference to a OU record type.

If I just set up an unconditional subscription, that works:

let subscriptionOUP = CKSubscription(recordType: "OUP", predicate:NSPredicate(value: true), subscriptionID: "oup", options: .FiresOnRecordUpdate)

But the conditional way not:

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)")

Terminal content:

ou == <CKReference: 0x1558d3d0;51D56239-D68C-4E12-BD23-E4DCEF5721B7:(_defaultZone:__defaultOwner__)> 

oup-51D56239-D68C-4E12-BD23-E4DCEF5721B7

What is the problem with my predicate or subscriptionID?

János
  • 32,867
  • 38
  • 193
  • 353

1 Answers1

0

The subscriptionID string is too long.

When you reduce it like this, it will work:

let ekf = "oup-\((organizationUser.recordID as NSString).substringToIndex(7))"
János
  • 32,867
  • 38
  • 193
  • 353
  • 1
    Yes I found this too! It silently fail without giving you any error. But the problem turns to be the length of subscription ID – Ben Lu Aug 28 '14 at 08:18