[英]Sqlite Database gets deleted from Documents Folder
We have an iOS application for the iphone that is having strange behavior. 我们有一个行为异常的iPhone iOS应用程序。 I store some data of the app in an SQLite Database file in the documents folder.
我将应用程序的一些数据存储在documents文件夹中的SQLite数据库文件中。 Every once in a while i realize that when the application crashes the file on the disk gets deleted.
我不时地意识到,当应用程序崩溃时,磁盘上的文件将被删除。 And i can´t figure out why the app would do this...Any Ideas?!
而且我不知道为什么该应用程序会这样做...任何想法?
Make sure that you're saving any documents for the application to the application's private folder in the documents. 确保将应用程序的所有文档保存到文档中应用程序的专用文件夹中。 I use this:
我用这个:
[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainask, YES) lastObject];
找到了解决方案...如果我将数据库保存在Cache Directory中而不是Documents目录中,那么它将起作用... :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.