I have a Core Data model in which a Task entity includes an optional to-many relationship excludedOccurrences. One of the properties of excludedOccurrences is start, which i
To test for an empty relationship you should compare the count of the to-many key to zero.
[NSPredicate predicateWithFormat:@"excludedOccurrences.@count == 0"];
As for your subpredicates, be aware that you can only have one of either the ALL
or ANY
modifiers in your final predicate, although you can use that modifier multiple times throughout the predicate.
Not OK: ANY foo.bar = 1 AND ALL foo.baz = 2
OK: ANY foo.bar = 1 AND !(ANY foo.baz != 2)