NSPredicate with a !=?

前端 未结 2 928
滥情空心
滥情空心 2021-01-27 05:41

I have Core Data Entities Person and Boundary. They have a many-to-many relationship (each person can have many boundaries, and each boundary can have many persons).

I a

2条回答
  •  孤独总比滥情好
    2021-01-27 06:38

    you need to ask first in Class Boundary if there is a person called Fred that has boundaries. It should be something like:

    NSFetchRequest* fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Boundary"];
    fetchRequest.predicate = [NSPredicate predicateWithFormat:@"ANY persons.name != %@", person.name];
    

    That will fetch all the boundaries that Fred doesn't have.

提交回复
热议问题