Reputation:
I need to sort my fetch request with selected people, but it doesn't return anything
I tried this code with coredata objects comparing
NSPredicate *peoplePredicate = [NSPredicate predicateWithFormat:@"SUBQUERY(classPeople, $p, $p IN %@).@count == %d", self.selectedPeople, [self.selectedPeople count]];
and this with nsnumber iD comparing
NSPredicate *peoplePredicate = [NSPredicate predicateWithFormat:@"SUBQUERY(classPeople, $p, $p.iD IN %@).@count == %d", self.selectedPeopleiD, [self.selectedPeopleiD count]];
I have entity class, which has relationship people. And I have viewcontroller where I can select some people in list, after selecting people objects are adding to array self.selectedPeople, so I need to fetch all objects of Class entity, which has selected people
thanks in advance
Upvotes: 1
Views: 678
Reputation: 7241
So, then your predicate should look like:
NSPredicate *peoplePredicate = [NSPredicate predicateWithFormat:@"ANY classPeople IN %@", self.selectedPeople];
Upvotes: 1