1

我需要用选定的人对我的获取请求进行排序,但它没有返回任何内容

我用 coredata 对象比较了这段代码

NSPredicate *peoplePredicate = [NSPredicate predicateWithFormat:@"SUBQUERY(classPeople, $p, $p IN %@).@count == %d", self.selectedPeople, [self.selectedPeople count]];

这与 nsnumber iD 比较

NSPredicate *peoplePredicate = [NSPredicate predicateWithFormat:@"SUBQUERY(classPeople, $p, $p.iD IN %@).@count == %d", self.selectedPeopleiD, [self.selectedPeopleiD count]];

我有实体类,它有关系人。我有视图控制器,我可以在列表中选择一些人,在选择人对象后添加到数组 self.selectedPeople,所以我需要获取已选择人员的 Class 实体的所有对象

提前致谢

4

1 回答 1

1

因此,您的谓词应如下所示:

NSPredicate *peoplePredicate = [NSPredicate predicateWithFormat:@"ANY classPeople IN %@", self.selectedPeople];
于 2013-03-26T21:10:51.787 回答