Data Loss Core Data

落爺英雄遲暮 提交于 2019-12-11 05:43:17

问题


I have reports from a handful of users of my production app that data has disappeared. My app has been in development/production for over 2 years now and I have never observed this data loss or have been able to reproduce it.

Here is the information I have:

  1. My app stores all of its data using core data

  2. I have iCloud/Core Data sync enabled. The sync is not working at all, but that is a separate issue all together.

  3. There is no mechanism in my app that deletes data without explicit permission from the user.

  4. One user described the data loss occurring after reopening the app after a crash. Could the fact the fact the data went missing after the app closed imply that the context isn't saving?

My hunch is that this is either some weird issue with iCloud/Core Data sync (see this) or my app on rare occasion does not save the context.

Regarding the saving, I should say that in 2 years of developing/testing the app I have never observed a save error. I should also point out that I do use the NSMergePolicy NSMergeByPropertyObjectTrumpMergePolicy for my context. I understand that the presence of a conflict without a merge policy can lead to save errors.

What are some potential causes for this data loss?

来源:https://stackoverflow.com/questions/33600914/data-loss-core-data

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