Standalone RLMObjects 的含义是什么,当它们具有任何观察到的属性时不能添加到 Realm
what's the meaning of Standalone RLMObjects cannot be added to a Realm while they have any observed properties
我不是很清楚Standalone RLMObjects cannot be added to a Realm while they have any observed properties meaning
的意思
这在 @interface RLMObject : RLMObjectBase
评论中有说明。
我搜索了文档,但是 none 对此有具体的解释。
谁能解释一下,并举例说明什么是允许的,什么是不允许的,什么是不好的结果?提前致谢。
这与最近添加到 Realm 的 Key-Value Observing compliance 特性有关。
本质上,当 Realm 对象中的 属性 更改时,可以使用 Apple 的 KVO 机制 (Introduction to Key-Value Observing Programming Guide) 注册一个对象,以便在 属性 发生更改时自动通知对象=24=] 已更改。
上面的陈述只是指您不能创建新的 Realm 对象,在其属性之一上注册 KVO,然后将其添加到 Realm 实例(按此顺序)。在这种情况下,有必要在 Realm 对象 将其添加到 Realm 实例后 上注册 KVO。
可以在文档中找到有关 Realm 如何与 KVO 一起工作的更多信息here。
希望对您有所帮助!
我不是很清楚Standalone RLMObjects cannot be added to a Realm while they have any observed properties meaning
这在 @interface RLMObject : RLMObjectBase
评论中有说明。
我搜索了文档,但是 none 对此有具体的解释。
谁能解释一下,并举例说明什么是允许的,什么是不允许的,什么是不好的结果?提前致谢。
这与最近添加到 Realm 的 Key-Value Observing compliance 特性有关。
本质上,当 Realm 对象中的 属性 更改时,可以使用 Apple 的 KVO 机制 (Introduction to Key-Value Observing Programming Guide) 注册一个对象,以便在 属性 发生更改时自动通知对象=24=] 已更改。
上面的陈述只是指您不能创建新的 Realm 对象,在其属性之一上注册 KVO,然后将其添加到 Realm 实例(按此顺序)。在这种情况下,有必要在 Realm 对象 将其添加到 Realm 实例后 上注册 KVO。
可以在文档中找到有关 Realm 如何与 KVO 一起工作的更多信息here。
希望对您有所帮助!