FMDatabaseQueue Error: database is locked
I have a method that runs in a background thread, and so (as I understand it) I need to use FMDatabaseQueue to safely and reliably access my SQLite database. I'm doing a query to check for the presence of a record, after which I immediately UPDATE or INSERT depending on the result. The first query runs fine and I get a count, but then the query that follows doesn't run. Here's the error I get: Unknown error calling sqlite3_step (5: database is locked) eu Here is my code: //Establish database queue NSString *path = [[PPHelpers documentsPath] stringByAppendingPathComponent:@"PilotPro2.db"];