0
我一直在搜索论坛,并在另一个用户问题上发现了一些代码,这是99%的我以后的问题。下面的代码片段...使用特定对象而不是对象属性获取核心数据
Bookshop *bookshop = (Bookshop *) nsManagedObjectFromOwner;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Books"
inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:
@"ANY bookshop.Name == '%@'",
bookshop.Name];
[fetchRequest setPredicate: predicate];
在此提取中,谓词正在搜索属于特定名称的书店的所有书籍。然而,在我的应用程序中,我的书店等同于客户,客户可能会有相同的名称。给定谓词的最佳方法是什么,我没有在客户实体中自己声明任何唯一的标识符?