CloudKit: CKSubscription with compound predicate does not works.
| Originator: | kaskaaddnb | ||
| Number: | rdar://18807663 | Date Originated: | 29-Oct-2014 01:30 PM |
| Status: | Duplicate of 18549283 (Open) | Resolved: | Not |
| Product: | iOS | Product Version: | 8.1 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: My goal is to notify user when special record is updated. Perhaps I'm interested in record with attributes firstName == John and lastName == Dow. For this I build CKSubscription with NSPredicate * sPredicate = [NSPredicate predicateWithFormat:@"firstName == %@ && lastName == %@", @"John", @"Dow"];. After the subscription successfully saved in my database, I test it updating attribute "age" of record for John Dow. I never get notification though. But when I build and save my subscription with non-compound predicate like [NSPredicate predicateWithFormat:@"firstName == %@", @"John"]; or [NSPredicate predicateWithFormat:@"lastName == %@", @"Dow"]; then the notifications works fine to me. Since there is no proper documentation about the restrictions of Subscription's predicates, I have no idea what is wrong. Steps to Reproduce: 1. Create and save record on cloud with attributes age:int, firstName:string, lastName:string with values 20, John, Dow respectively. 2. Create and save subscription with predicate [NSPredicate predicateWithFormat:@"firstName == %@ && lastName == %@", @"John", @"Dow"]; to get notified when John Dow's age is changed. 3. Change John Dow's age (either in a Dashboard or from your app). Expected Results: After age changed and record is saved the notification must be received. Actual Results: No notification received. Version: iOS 8.1 Notes: Configuration: iPhone 5
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
new info added:
after hours of experiments my compound predicate started working. It was a syntax problem, which is not documented! Not working predicate: @"firstName == %@ && lastName == %@". Working one: @"(firstName == %@) AND (lastName == %@)".