I have an attribute of type BOOL
and I want to perform a search for all managed objects where this attribute is YES
.
For string attributes it is straightforward. I create a predicate like this:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"userName = %@", userName];
But how do I do this, if I have a bool attribute called selected and I want to make a predicate for this? Could I just do something like this?
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"selected = %@", yesNumber];
Or do I need other format specifiers and just pass YES
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…