iphone - All 子句核心数据谓词未按预期工作

标签 iphone core-data nspredicate

我的核心数据模型是这样的:

EntityA <---->> EntityB <<----> EntityC

现在,我想获取 EntityB 的对象,其中 EntityC == nil

我考虑了很多选择:

我尝试过的是:

任何 EntityB.EntityC == nil

虽然这不会给出错误,但它并没有按照我的预期工作,因为这会搜索 EntityA 的所有对象,即使其中一个不是 nil,它也会获取 EntityA 的对象。

所以我尝试的是:

所有 Participant.ParticipantCategory == nil

但这会产生错误:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported predicate (null)

我也尝试过使用子查询,但没有成功。我花了几个小时试图解决这个问题,但没有成功。

有什么想法吗?

最佳答案

我认为你的谓词应该是:Participant.ParticipantCategory == nil

ANY 关键字描述 here 。我认为它的行为是应该的。而且我不知道 ALL 关键字。

关于iphone - All 子句核心数据谓词未按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11259984/

相关文章:

cocoa - 我没有收到 NSPersistentStoreDidImportUbiquitousContentChangesNotification (带有代码示例)

iphone - 是否可以在 NSFetchRequest 的 NSPredicate 中使用父实体的属性?

iphone - 如果您丢失了私钥,删除旧的分发证书会产生什么后果? (iPhone SDK)

iphone - iTunesArtwork 和 XCode

ios - 获取结果 Controller 委托(delegate)在 swift 1.2/xcode 6.3 更新后未调用

ios - 如何用应用程序更新强制替换 CoreData 存储?

swift - 如何根据多关系集是否包含特定值使用 NSPredicate 进行过滤

cocoa - NSPredicate 和数组

iphone - 如何根据公钥的指数和模数创建 SeckeyRef 并在 SecKeyEncrypt 方法中使用

iphone - 声音在模拟器中工作,而不是在真实 iPhone 中工作