Mejdi Lassidi
Mejdi Lassidi

Reputation: 999

problem with a compound nspredicate

what is a problem with this predicate:

NSPredicate *predicate1 = [NSPredicate predicateWithFormat:@"(category like[cs] %@) AND (aroundme==YES)",category];

? Thks.

Upvotes: 0

Views: 326

Answers (3)

Mejdi Lassidi
Mejdi Lassidi

Reputation: 999

excuse me the problem was not there .. i did'nt add the category attribute to the DB

Upvotes: 0

stephen
stephen

Reputation: 1061

I think you need to instead pass in [NSNumber numberWithBool:YES] to aroundme==%@ like so:

NSPredicate *predicate1 = [NSPredicate predicateWithFormat:@"(category like[cd] %@) AND (aroundme==%@)",category, [NSNumber numberWithBool:YES]];

That is unless you are looking for the string 'YES'. Then, the resulting predicate should quote YES.

Upvotes: 0

Dave DeLong
Dave DeLong

Reputation: 243156

There is no such thing as an [s] comparison modifier. The only ones are [c], [d], or [cd].

Upvotes: 3

Related Questions