简体   繁体   English

从文档文件夹中删除Sqlite数据库

[英]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.

相关问题 iPhone的任何接口来处理在应用程序的Documents文件夹中创建的sqlite数据库? - iphone any interface to deal with sqlite database created in the application Documents folder? 从SQlite数据库搜索记录时,iPhone应用程序变慢 - iPhone Application gets slow while searching record from SQlite Database 显示文档文件夹中的图像 - Show image from documents folder 无法将sqlite数据库从app的mainbundle复制到用户文档 - Can't copy sqlite database from app's mainbundle to users documents 模拟器中的Documents文件夹为空。 我的db.sqlite在哪里? - Documents folder is empty in simulator. Where is my db.sqlite? 从文档目录中提取数据库 - Pull Database from Documents Directory iCloud是否会自动备份document目录中的Core Data sqlite数据库? - Is Core Data sqlite database in the documents directory automatically backed up by iCloud? iPhone-从文件文件夹执行iPhone应用程序 - iPhone - Execute iphone app from documents folder 我应该将sqlite数据库文件写入Documents目录还是Library / Caches? - Should i write sqlite database file to Documents directory or Library/Caches? 在iOS中将先前创建的Sqlite数据库写入文档的最佳方法是什么 - What is the best way to write a previously created Sqlite database to documents in iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM