I have two entities in core data (call them entityOne and entityTwo). I have a entityOne<—>>entityTwo relationship between them.
I am now trying to code an NSPredicate to fetch entityTwo objects on the following basis:
-
Fetch entityTwo objects that have a relationship with a specified entityOne object.
-
Filter out those entityTwo objects which have no value for one of their attributes.
I am best doing both of these in an NSPredicate or is there a better way?
I am trying the following:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(attribute <> "") AND (relationship == entityOne"];
[request setPredicate:predicate];
Any pointers on coding great fully received.
You can use a Predicate like this:
Pretty common approach to do that.