简体   繁体   中英

iOS - Sqlite read and write simultaneously

In my application, I've two threads running. One will be querying the server and updates the database. Other thread will get the data and update the UI.
The issue is that when both read and write are calling database simultaneously one is failing.
the error is as follows:
Error while creating SELECT c.id, c.address, c.type, e.id, e.name, e.logo, e.system, c.city FROM cashpoints c, entities e WHERE e.id = c.entity AND c.id =?; => 'database is locked'

As mentioned in the comments by @meccan, the solution is to use FMDB or better go with core data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM