Look for nested calls to FMDatabase
method beginTransaction
and/or manually executing the BEGIN TRANSACTION
SQL. Or, if using FMDatabaseQueue
, look for situations where you might call inTransaction
from within another inTransaction
block.
Alternatively, if you're manually calling beginTransaction
and/or performing BEGIN TRANSACTION
, make sure that's offset by a balancing commit
/rollback
or executing a COMMIT
/END
/ROLLBACK
SQL. This is the benefit of using FMDatabaseQueue
method inTransaction
, because you know you cannot accidentally neglect to end the transaction.
Bottom line, make sure you don't begin one transaction without ending the prior one. If you're not finding it, put breakpoints/log statements everywhere you enter a transaction and everywhere you exit a transaction, and the problem should become apparent quickly.