2
votes

I'd like to write a single NSPredicate that would work for both to-one and to-many relationships:

1) I have an NSMutableArray that will run the filterUsingPredicate method

2) The NSPredicate will filter out a selected relationship that contain any objects in the relationship (again, for both to-one and to-many relationships).

I've tried something like predicateWithFormat:@"relationshipObjects.@count == 0", but this only seems to work for to-many relationships. Is there a similar predicate format that will work for both to-one and to-many relationships?

1

1 Answers

1
votes

I think, you can use check for nil here.

predicateWithFormat:@"relationshipOject != nil"