I have a core data entity, Client, which has a discountproperty. I want to fetch the the client with the smallest discount.
I am using the following NSPredicate:
[NSPredicate predicateWithFormat:@"@min.discount"];
However, I am getting the following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "@min.discount"'
What am not doing right?
I don’t think
NSPredicatehas support for functions like this unless it is part of a boolean predicate expression (i.e. involving things like “greater than”).You should read this CoreData documentation which gives some examples, specifically using
maxas an example: