I'm having trouble compoun开发者_运维技巧ding NSPredicate with AND, although using OR works fine.
Imagine 2 entities, Doctor and Patient. Doctors can have many patients and patients many doctors. I want to find doctors that, say, have both person1 and person2 as patients. I expected this to work but it returns none.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY patients matches 'person1&&person2'"];
If I change && to ||, I get all doctors that have person1 or person2 as I'd expect.
Thanks in advance for your help.
It looks like a known issue that 2 ANY statements can't be compounded via AND. Back to the drawing board... link text
精彩评论