-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disk I/O error when device is locked #262
Comments
I'm also seeing this problem. On a very limited set of devices, I am unable to write to my database when the device is locked in background mode. |
I have tracked down this issue. You'll need to set your fileprotection when you open the database.
in your case, currentDB = [FMDatabase databaseWithPath:pathToDatabase];
[currentDB openWithFlags:SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FILEPROTECTION_NONE]; |
thanks, i tried setting the file protection at the db file. |
Well this is interesting, I've not encountered these flags before. Here's a relevant post from an apple mailing list: http://lists.apple.com/archives/cocoa-dev/2012/Aug/msg00527.html |
This still does not work in our tests. Even setting
fileAttributes are:
|
I can confirm this is an SQLite implementation bug at least on iOS 7.2.1 and iOS 8 (GM). |
We're not having any issues on iOS 7.0 - 8.0 using the following to initially open the database: _database =
[FMDatabaseQueue databaseQueueWithPath:dbPath
flags:SQLITE_OPEN_READWRITE |
SQLITE_OPEN_CREATE |
SQLITE_OPEN_FILEPROTECTION_NONE]; It looks from your snippet that you're database has already been opened with the default flags. |
We are having issues when the app runs in background and the device is locked, even though the protection is none.
|
If has passcode and device is locked,write to the database(file) will get disk I/O error.
|
@rodmaz I am having the same problem:
I tried to open the FMDatabaseQueue with:
And the problem still there. I also tried to change the attribures of the folder that contains the SQLite file as said @Moncter that is Documents like in the example. Any new idea? |
The problem I had was that the DB was created somewhere else with invalid arguments. |
Finally my problem was that I can not access to any file on the Sandbox. After a few minutes with the device locked I can not access to the Database but also I can not access to any file on my Sandbox so the problem was there. Thanks for your help anyway @rodmaz |
@javiergonzper my problem was similar with yours ,I also can |
Hey @Marviszhao yes.
|
@javiergonzper thanks for you advance, I set all file with that attibute and finally it worked! |
hi , it work for me but i only can read from the database i can't write .does enyone have this problems ? plz help me i dont know what to do :( thank u |
@hamza1307 did you open database with @purdyk said |
thank you very much |
Hi, I got the following error if i write to the database when the device is locked,and my device system is iOS9.1 i works fine if the app is in running in the background without locking the device. I'v tried to set the file protection to none with the following code: [[NSFileManager defaultManager] setAttributes:[NSDictionary dictionaryWithObject:NSFileProtectionNone forKey:NSFileProtectionKey] ofItemAtPath:document error:NULL]; _dataQueue = [FMDatabaseQueue databaseQueueWithPath:dbPath flags:SQLITE_OPEN_READWRITE | but it will still raise the same error.And I remember before iOS9.1 system, there have not been Appear this error. Is there something i'm missing ? |
@lqdncel not sure that setting |
has everybody fix this issue? But unfortunately, this issue also exist. |
Yes it is。I'm find the answer... |
Hi,
i get the following error if i write to the database when the device is locked:
Unknown error calling sqlite3_step (10: disk I/O error)
i works fine if the app is in running in the background without locking the device.
I'v tried to set the file protection to none with the following code:
currentDB = [FMDatabase databaseWithPath: pathToDatabase];
[[NSFileManager defaultManager] setAttributes:[NSDictionary dictionaryWithObject:NSFileProtectionNone forKey:NSFileProtectionKey] ofItemAtPath: pathToDatabase error:&error];
but it will still raise the same error.
Is there something i'm missing ?
The text was updated successfully, but these errors were encountered: