核心数据存储损坏 [英] Core Data store corruption
问题描述
我的iPhone应用程序的少数客户正在经历Core Data存储损坏(我假设这样,因为错误无法保存到数据存储:操作无法完成。(Cocoa错误259。))
有没有人遇到过这种商店腐败?我担心,因为我的目标是很快推出执行模式迁移的更新,我担心这将暴露更多的问题。
我假设核心Data / SQLlite API使用原子操作,除非底层文件系统经历损坏,否则不受损坏。
有一种方法可以减少/防止损坏,
编辑:
这个错误:数据库在/var/mobile/Applications//Documents/foo.sqlite已损坏。SQLite错误代码11,数据库磁盘映像格式错误。
当我手动重写我的 Base.sqlite
而不删除 Base.sqlite-wal
和
Base.sqlite-shm
。确实,这些文件是新的SQLite 3.7功能,可能在iOS 7中添加。
为了解决这个问题,我删除了 Base.sqlite - *
,sqlite从我的新基本版本中重新生成了它们。
A handful of customers for my iPhone app are experiencing Core Data store corruption (I assume so, since the error is "Failed to save to data store: Operation could not be completed. (Cocoa error 259.)")
Has anyone else experienced this kind of store corruption? I am worried since I aim to soon push an update which performs a schema migration, and I am worried that this will expose even more problems.
I had assumed that the Core Data/SQLlite APIs use atomic operations and are immune to corruption except if the underlying filesystem experiences corruption.
Is there a way to reduce/prevent corruption, and a way to reproduce the corruption so I can test this (I have been unsuccessful thus far).
Edit:
Also getting this error: "The database at /var/mobile/Applications//Documents/foo.sqlite is corrupted. SQLite error code 11, database disk image is malformed."
It happens to me when I manually overwrote my Base.sqlite
without deleting Base.sqlite-wal
and Base.sqlite-shm
. Indeed, these files are new SQLite 3.7 features, maybe added in iOS 7.
To resolve the problem, I deleted Base.sqlite-*
and sqlite regenerated them from my new base version.
这篇关于核心数据存储损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!