核心数据存储损坏 [英] Core Data store corruption

查看:111
本文介绍了核心数据存储损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的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屋!

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