IPhone SQLite application prepare crash expression

One of the applications I create uses SQLite to store data downloaded from the server.

The application itself uses multithreading, as the application starts, the application downloads data in the background, and also presents the user interface to the user.

The user at this point in time can start navigating the application by clicking on the rows of the table to expand the detailed pages.

Sometimes, when I click on a table row, an application crashes out of one of many sqlite3_prepare_v2 () function calls. This happened much more often when I allow more than 1 max simultaneous operation for my NSOperationQueue. However, this happened much less now that I have limited the maximum number of simultaneous operations to 1.

When my application starts, I open the database connection and I keep it open until the application should terminate, then I close the connection.

Here is an example of the line with which it falls:

if(sqlite3_prepare_v2(objDatabase, [strGet cStringUsingEncoding:NSUTF8StringEncoding], -1, &stmtGet, NULL) == SQLITE_OK)
{
    ...
}

Error: EXEC_BAD_ACCESS

As 1 of 20 or 1 of 30 applications, it will be broken. Thus, my SQL statement works in 99% of cases.

Has anyone ever had this before?

+3
source share
2 answers

. sqlite3_prepare_v2 , sqlite3_finalize. , sqlite3_finalize , sqlite3_prepare_v2. , , . , .

squb sqlite3_prepare_v2 sqlite3_finalize, NSLog. .

+3

, - prblem - , - . , , , . , , .

ns zombie

> >

0

All Articles