iPhone Coredata错误(NSMergeConflict为NSManagedObject) [英] iPhone Coredata error (NSMergeConflict for NSManagedObject)

查看:89
本文介绍了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 :)


conflictList =(
NSMergeConflict(0xd447640)for NSManagedObject(0xd41b370)with objectID'0xd41b500'with oldVersion = 4 and newVersion = 5 and old object snapshot = {\\\
album = \{ \\\
)} \; \\\
audios = \{(\\\
)} \; \\\
bdate = \\; \\\
city = \\ ; \ n country = \\; \\\
dialog = \{(\\\
)} \; \\\
domain = \white.smoke\; \ n faculty = 0; \ n facultyName = \\; \\\
firstName = White; \\\
graduation = 0; \\\
homePhone = \\; \\\
isFriend = 1; \\\
isMe = 0; \\\
lastName = Smoke; \\\
mobilePhone = \\; \\\
nickName = \\; \\\
online = 1; \\\
photo = \\; \\\
photoBig = \\; \\\
photoComments = \{(\\\
)} \; \\\
photoMedium = \\; \\\
photoRec = \http://cs10609.vkontakte.ru/u79185807/e_8c949409.jpg\; \\\
photos = \{(\\\
(entity:Photo; id:0xd482c50; data :{\\\
aid = 121594781; \\\
album = nil; \\\
comments = \\\\; \\\
commentCount = 0; \\\
created = \\2010 -12-10 03:45:01 GMT\\; \\\
owner = \\0xd41b500 \\; \\\
\\owner_id\\= 79185807; \\\
photosNumber = 0; \\\
pid = 196997145; \\\
src = \\http://cs10609.vkontakte.ru/u79185807/121594781/m_\\; \\\
\ \src_big\\= \\http://cs10609.vkontakte.ru/u79185807/121594781/x_\\; \\\
\\src_small\\ = \\http://cs10609.vkontakte.ru/u79185807/121594781/s_\\; \\\
\\src_xbig\\= nil; \\\
\\\ \\src_xxbig\\= nil; \\\
wallRel = \\0xd480840 \\; \\\
}),\\\
(entity:Photo; id:0xd431570; data:{\\\
aid = 121594781; \\\
album = nil; \\\
comments = \\\\; \\\
commentCount = 0; \\\
created = \\ 2010-12-10 03:43:01 GMT\\; \\\
owner = \\0xd41b500 \\; \\\
\\owner_id\\= 79185807 ; \\\
photosNumber = 0; \\\
pid = 196997029; \\\
src = \\http://cs10609.vkontakte.ru/u79185807/121594781/m_\\; \\\
\\ \\\src_big\\= \\http://cs10609.vkontakte.ru/u79185807/121594781/x_\\; \\\
\\src_small\\ = \\http://cs10609.vkontakte.ru/u79185807/121594781/s_\\; \\\
\\src_xbig\\= nil; \\\
\ \src_xxbig\\= nil; \\\
wallRel = \\0xd42d500 \\; \\\
})\\\
)} \; \\\
rate = \ -19\; \\\
sex = 0; \\\
statuses = \{(\\\
)} \; \\\
timezone = 0; \\\
uid = 79185807; \\\
university = 0; \\\
universityName = \\; \\\
videos = \{(\\\
)} \; \\\
wall = \{(\\\
)} \; \\\
wallPostsCount = 0; \\\
wallReplies = \{(\\\
(entity:WallReply; id:0xd448270; data:)\\\
)} \; \\\
wallSender = \{(\ n)} \; \ n}和新的缓存行= {\\\
bdate = \\; \\\
city = \\; \ n country = \\; \\\
domain = \white.smoke\; \ n faculty = 0; \\\
facultyName = \\; \\\
firstName = White ; \\\
graduation = 0; \\\
homePhone = \\; \\\
isFriend = 1; \\\
isMe = 0; \\\
lastName = Smoke; \\\
mobilePhone = \ \\; \\\
nickName = \\; \\\
online = 1; \\\
photo = \\; \\\
photoBig = \\; \\\
photoMedium = \\; \\\
photoRec = \http://cs10609.vkontakte.ru/u79185807/e_8c949409.jpg\; \\\
rate = \-19\; \\ \\ n sex = 0; \\\
timezone = 0; \\\
uid = 79185807; \\\
university = 0; \\\
universityName = \\; \\\
wallPostsCount = 0; \\\
}
);

conflictList = ( "NSMergeConflict (0xd447640) for NSManagedObject (0xd41b370) with objectID '0xd41b500 ' with oldVersion = 4 and newVersion = 5 and old object snapshot = {\n album = \"{(\n)}\";\n audios = \"{(\n)}\";\n bdate = \"\";\n city = \"\";\n country = \"\";\n dialog = \"{(\n)}\";\n domain = \"white.smoke\";\n faculty = 0;\n facultyName = \"\";\n firstName = White;\n graduation = 0;\n homePhone = \"\";\n isFriend = 1;\n isMe = 0;\n lastName = Smoke;\n mobilePhone = \"\";\n nickName = \"\";\n online = 1;\n photo = \"\";\n photoBig = \"\";\n photoComments = \"{(\n)}\";\n photoMedium = \"\";\n photoRec = \"http://cs10609.vkontakte.ru/u79185807/e_8c949409.jpg\";\n photos = \"{(\n (entity: Photo; id: 0xd482c50 ; data: {\n aid = 121594781;\n album = nil;\n comments = \\"\\";\n commentsCount = 0;\n created = \\"2010-12-10 03:45:01 GMT\\";\n owner = \\"0xd41b500 \\";\n \\"owner_id\\" = 79185807;\n photosNumber = 0;\n pid = 196997145;\n src = \\"http://cs10609.vkontakte.ru/u79185807/121594781/m_\\";\n \\"src_big\\" = \\"http://cs10609.vkontakte.ru/u79185807/121594781/x_\\";\n \\"src_small\\" = \\"http://cs10609.vkontakte.ru/u79185807/121594781/s_\\";\n \\"src_xbig\\" = nil;\n \\"src_xxbig\\" = nil;\n wallRel = \\"0xd480840 \\";\n}),\n (entity: Photo; id: 0xd431570 ; data: {\n aid = 121594781;\n album = nil;\n comments = \\"\\";\n commentsCount = 0;\n created = \\"2010-12-10 03:43:01 GMT\\";\n owner = \\"0xd41b500 \\";\n \\"owner_id\\" = 79185807;\n photosNumber = 0;\n pid = 196997029;\n src = \\"http://cs10609.vkontakte.ru/u79185807/121594781/m_\\";\n \\"src_big\\" = \\"http://cs10609.vkontakte.ru/u79185807/121594781/x_\\";\n \\"src_small\\" = \\"http://cs10609.vkontakte.ru/u79185807/121594781/s_\\";\n \\"src_xbig\\" = nil;\n \\"src_xxbig\\" = nil;\n wallRel = \\"0xd42d500 \\";\n})\n)}\";\n rate = \"-19\";\n sex = 0;\n statuses = \"{(\n)}\";\n timezone = 0;\n uid = 79185807;\n university = 0;\n universityName = \"\";\n videos = \"{(\n)}\";\n wall = \"{(\n)}\";\n wallPostsCount = 0;\n wallReplies = \"{(\n (entity: WallReply; id: 0xd448270 ; data: )\n)}\";\n wallSender = \"{(\n)}\";\n} and new cached row = {\n bdate = \"\";\n city = \"\";\n country = \"\";\n domain = \"white.smoke\";\n faculty = 0;\n facultyName = \"\";\n firstName = White;\n graduation = 0;\n homePhone = \"\";\n isFriend = 1;\n isMe = 0;\n lastName = Smoke;\n mobilePhone = \"\";\n nickName = \"\";\n online = 1;\n photo = \"\";\n photoBig = \"\";\n photoMedium = \"\";\n photoRec = \"http://cs10609.vkontakte.ru/u79185807/e_8c949409.jpg\";\n rate = \"-19\";\n sex = 0;\n timezone = 0;\n uid = 79185807;\n university = 0;\n universityName = \"\";\n wallPostsCount = 0;\n}" );


推荐答案

从两个不同的地方,然后从两个不同的地方救了;在某些情况下,更改可能会影响相同的对象或属性,并且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.

选项:

  • 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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