NSMergeConflict为NSManagedObject

NSMergeConflict为NSManagedObject

本文介绍了iPhone Coredata错误(NSMergeConflict为NSManagedObject)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候我在同一个地方有coredata的这个错误。有时它的确定,在其他时候我有这个错误。这是什么意思?我找不到任何资料:(

Sometimes i have this error with coredata in the same place. Sometimes its ok, and in other time i have this error. What does it mean? I can't find anything about it :(

ps对不起我的英文:)

ps sorry for my english :)


推荐答案

从两个不同的地方,然后从两个不同的地方救了;在某些情况下,更改可能会影响相同的对象或属性,并且Core Data不会自动覆盖它们,因为这可能会破坏有价值的数据。

A merge conflict sometimes results when your database gets changed from two different places, then saved from two different places; in certain cases, the changes might affect the same objects or properties, and Core Data doesn't automatically overwrite them, as that might destroy valuable data.

选项:


  • 当发生合并冲突时,迭代其信息,并根据应用程序的需要手动解决任何冲突。 / li>
  • 以快速紧密将更改集成到尚未保存的托管对象上下文中。请注意,这可能需要一定程度的冲突解决,但应有助于最大限度地减少严重性。

  • When you get a merge conflict, iterate through its information, and manually resolve any conflicts according to the needs of your application.
  • Set the merge policy of the managed object context(s) to one that will automatically resolve certain kinds of conflicts. Some merge policies are partially destructive, some are very destructive – which one is right really depends on your application and the importance of the data being saved.
  • Use mergeChangesFromContextDidSaveNotification: to quickly and closely integrate changes into managed object contexts that haven't been saved yet. Note that this may still require some level of conflict resolution, but should help minimize the severity.

这篇关于iPhone Coredata错误(NSMergeConflict为NSManagedObject)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 13:57