iphone - Child 的 child 的反向关系

标签 iphone ios ipad core-data relationship

我正在尝试使用核心数据关系在 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/

相关文章:

ios - 如何理解 iPhone 上的崩溃报告 iOS 测试

iPad > Appcelerator > Alloy > 如何为特定 Controller 加载不同的 View ?

html - iPad 上的 iframe 大小

iphone - 在后台线程中上传批量图像

iphone - 当 UIImageView.image 设置 2-3 次时应用程序崩溃

ios - 在 UITableView Segues 之前运行后台线程

ios - 以编程方式将自定义 UIViewcontroller 添加到 subview 但收到错误消息 "Cannot convert value of type..."

ios - IOS 中的 Facebook 错误代码=7

iphone - Flash cs5 iOS 按住不放?

iphone - iOS开发:为什么我的链接器看不到我的类(class)?