我有一个核心数据实体Client,它具有discount属性。我想以最小的折扣获取客户。

我正在使用以下NSPredicate:

[NSPredicate predicateWithFormat:@"@min.discount"];

但是,我收到以下错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "@min.discount"'

做什么不对吗?

最佳答案

我不认为NSPredicate不支持这样的功能,除非它是 bool 谓词表达式的一部分(即涉及“大于”之类的东西)。

您应该阅读this CoreData documentation,其中提供了一些示例,特别是使用max作为示例:

关于ios - iOS:在核心数据谓词中使用@min和@max,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10978010/

10-14 21:24
查看更多