我正在使用核心数据并在函数中:
- (NSFetchedResultsController*)fetchedResultsController()
我想使用可以让 NSFetchRequest 返回具有给定关系值的托管对象的谓词。我试过这个:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"belongToS like[cd] %@", (S*)self.s];
[fetchRequest setPredicate:predicate];
Note:
- belongToS: relationship of type (S *)
- self.s is a managed object casted to type (S *) since it is of NSManagedObject and actually it's truly an object of type (S *).
当我运行代码时,它不会返回任何东西!我怎样才能编辑它以使其工作?是否有任何最佳解决方案来获取具有相同关系值的对象?