核心数据 - 为什么不自动设置逆关系? [英] Core Data - Why isn't inverse relationship set automatically?

查看:159
本文介绍了核心数据 - 为什么不自动设置逆关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 NSManagedObject 上的 NSOrderedSet 有一对多的关系。

I have a a one-to-many relationship as an NSOrderedSet on an NSManagedObject.

当对有序集合调用 addObject:方法时(我从 NSManagedObjectModel 子类对象),但是,不会自动设置逆关系。什么原因可能导致这种情况?

When the addObject: method is called on the ordered set (which I'm calling from a property on an NSManagedObjectModel subclass object), however, the inverse relationship is not being set automatically. What can cause this?

作为相关的注意事项,我使用神奇记录更容易将数据映射到 NSManagedObject 对象。

As a related note, I am using Magical Record to make it easier to map data to the NSManagedObject objects.

此外,我也引用了这篇文章,但我不会覆盖我的子类中的这些方法:

Further, I've also referred to this post, but I'm not overriding these methods on my subclass:

核心数据反关系未设置

推荐答案

NSOrderedSet 有严重错误在核心数据。请参阅这篇文章,了解目前如何解决这些问题:

NSOrderedSet has serious bugs in Core Data. See this post on ways to get around them for the time being:

NSOrderedSet中生成的异常生成访问器

这篇关于核心数据 - 为什么不自动设置逆关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆