I am making iOS app which is having both background and foreground database operations. I am getting 'Database locked' exception. The one most common scenario is -when my app inserting/updating/fetching data from database in background at same time if I am fetching data from database in foreground database gets locked. I am using raw sqlite queries.
- I have made one common class for Database operation, do I need to make it singleton class?
- Does such type of operation are done using sqlite in iOS?
- I have read about THREAD_SAFE for sqlite, but not getting how to do THREAD_SAFE.
Any other approach is also appreciated..