使用继承属性获取Coredata

时间:2013-03-29 07:19:46

标签: ios core-data

我有一个数据模型如下。

Chat -> abstract entity
ChatUser -> inhertied from Chat. 
         -> has a relationship to user model that has a name attribute
ChatGroup -> inherited from Chat
          -> has a relationship to group that also has a name attribute. 

我需要使用来自用户名或组名的名为“ABC”的fetchedresultscontroller来获取所有聊天。我似乎无法使用单个谓词来获取它们。有没有办法可以单独获取它们并合并结果。

1 个答案:

答案 0 :(得分:0)

无法实例化抽象实体,因此您无法在获取请求中获取它们。将Chat保留为其他两个的父实体,但不要将其抽象化。

https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdMOM.html

相关问题