I use SQLite persistent storage. I have an NSManagedObject class Den with a to-many Bear relation. Bear has several fields:
Bear: breed color age ...
When I create select queries for my Den objects, I can filter objects that have a Bear associated with a specific field value:
NSPredicate *hasGrizzlyPred = [NSPredicate predicateWithFormat:@"ANY Bear.breed == 'grizzly'"];
Or I can just as easily find Den that has a brown bear:
NSPredicate *hasBrownBearPred = [NSPredicate predicateWithFormat:@"ANY Bear.color == 'brown'"];
But is there a way to find Den with a bear that is brown and grizzly? The following is right, but false, I think:
objective-c iphone core-data nspredicate
Seamus campbell
source share