开发者

I am having problems with my NSPredicate

开发者 https://www.devze.com 2023-04-06 01:34 出处:网络
I\'m trying the following comparison but it does not work. What is the appropriate syntax to use both the or/and operator within the same context?

I'm trying the following comparison but it does not work.

What is the appropriate syntax to use both the or/and operator within the same context?

N开发者_开发百科SPredicate* predicate = [NSPredicate predicateWithFormat:@"((day || day2 ==%@) && CourseTitle==%@)",day,courseSelected];
rows = [[courseArray filteredArrayUsingPredicate:predicate]retain];


Try:

NSPredicate* predicate = [NSPredicate predicateWithFormat:@"(((day == %@) OR (day2 == %@)) && CourseTitle==%@)",day, day, courseSelected];
rows = [[courseArray filteredArrayUsingPredicate:predicate]retain];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号