One of the app I am building uses SQLite to store data that was downloaded from a server.
The app itself uses multi threading so as the app launches, the app downloads data in the background while it also presents the UI to the user.
The user at this point in time can begin navigating the app, tapping on table rows to drill into detail pages.
Sometimes when I tap on a table row, the app crashes at one of the many sqlite3_prepare_v2() function calls. It happened a lot more frequent when I allow more than 1 max concurrent operation for my NSOperationQueue. However, it has happened a lot less now that I have limited the max concurrent operation count to 1.
When my app launches, I am opening a database connection and I am keeping it open until the app needs to terminate, then I close the connection.
Here is a sample line it crashes at:
if(sqlite3_prepare_v2(objDatabase, [strGet cStringUsingEncoding:NSUTF8StringEncoding], -1, &stmtGet, NULL) == SQLITE_OK)
{
...
}
Error says EXEC_BAD_ACCESS
Like 1 out of 20 or 1 out of 30 app runs, it would crash. So that means my SQL statement works 99% of the time.
Anyone ever had this happen before?