开发者

Fetching data from CoreData with multiple Entities

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜