I have a data model that has 2 entities Person and Photo, they have have Attributes named name
how can I be sure when using a NSPredicate
that I will fetch or evaluate information from the correct entity if I'm looking by name
?
This would be my current NSPredicate
but I'm really unsure on the issue:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name == %@", [currItem objectForKey:@"user"]];
You would set the appropriate entity on the NSFetchRequest
that you're using to fetch the entities. The name field would correspond to the name field on whatever entity you set.
精彩评论