Core data 核心数据关系实体的谓词,其中所有Foo==否

Core data 核心数据关系实体的谓词,其中所有Foo==否,core-data,nspredicate,Core Data,Nspredicate,我想知道如何让所有关系对象匹配布尔值 创建具有任何可用性的谓词: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY journeyPart.lastPart == NO"]; 但如果我试着这样做,我就会崩溃: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ALL journeyPart.lastPart == NO"]; 谢谢 卡尔。我可以重

我想知道如何让所有关系对象匹配布尔值

创建具有任何可用性的谓词:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY journeyPart.lastPart == NO"];
但如果我试着这样做,我就会崩溃:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ALL journeyPart.lastPart == NO"];
谢谢


卡尔。

我可以重现这个问题,在我看来,它就像一个核心数据错误。作为一种解决方法,您的

[NSPredicate predicateWithFormat:@"ALL journeyPart.lastPart == NO"]
相当于

[NSPredicate predicateWithFormat:@"SUBQUERY(journeyPart, $x, $x.lastPart != NO).@count = 0"]

这在我的测试应用程序中正常工作。

我可以重现这个问题,在我看来它就像一个核心数据错误。作为一种解决方法,您的

[NSPredicate predicateWithFormat:@"ALL journeyPart.lastPart == NO"]
相当于

[NSPredicate predicateWithFormat:@"SUBQUERY(journeyPart, $x, $x.lastPart != NO).@count = 0"]

这在我的测试应用程序中正常工作。

非常感谢您的帮助。。。它让我困惑了很长一段时间,我不知道SQLsyntax@CarlT:不客气。但子查询不是SQL语法,而是NSExpression/NSPredicate语法。。。。啊很有趣。。。我会仔细看一看:)非常感谢。。。它让我困惑了很长一段时间,我不知道SQLsyntax@CarlT:不客气。但子查询不是SQL语法,而是NSExpression/NSPredicate语法。。。。啊很有趣。。。我仔细看看:)