Magical Record add object, different context error

↘锁芯ラ 提交于 2019-12-05 21:47:31

self.entry was created in different context, so you can't access it from this one. Instead of:

[self.entry addNotesObject: newNote];

you should first find self.entry object in localContext:

[[self.entry MR_inContext:localContext] addNotesObject: newNote];

You can find an explanation of using MagicalRecord in a concurrent environment at Performing Core Data operations on Threads. Though it's quite short, so in my opinion it's worthwhile to read Core Data Programming Guide even though you don't use CD directly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!