Inconsistent but frequent access to EXC_BAD_ACCESS using sqlite3_step (statement)

I get frequent EXC_BAD_ACCESS crashes in iOS when this line is executed:

while (sqlite3_step(statement) == SQLITE_ROW) { } 

Used to provide results in my function (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath .

Any ideas? SQL etc. It looks fine and the database is updated in the background thread, after which I call the foreground thread to update the interface.

+4
source share
1 answer

If the database is updated in the background and you access it in the foreground thread, I highly recommend using some kind of locking mechanism to prevent a racial situation. I do not think sqlite is thread safe.

+2
source

Source: https://habr.com/ru/post/1399776/


All Articles