我正在尝试使用核心数据关系在 child 的子对象之间建立反向关系。
这是我要实现的目标的示例:
我有多个文件柜,每个文件柜有多个抽屉,每个抽屉有多个文件。
- 文件柜有一对多抽屉
- 抽屉与文件柜相反
- Drawer 有一个 to-many to File
- 文件与抽屉相反
When I add a file to a drawer the drawer sets itself as the inverse on the file however, I want an automagic cabinet inverse on a a file too. So i can do something like
[file cabinet]
as well as the standard[file drawer]
Right now, I can't create this particular inverse.
我知道我可以使用 [[file drawer] cabinet]
但这是我用例的一个简单示例。
最佳答案
为什么不直接向您的 NSManagedObject
子类添加一个方法?
- (Cabinet *)cabinet;
{
return self.drawer.cabinet;
}
关于iphone - Child 的 child 的反向关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10390469/