I've spent the past few hours searching this group and other places to try to find the best approach for supporting background syncing while allowing the user to continue using the application. User access is mostly read-only, but they can add/edit some content. This is currently supported using a FMDatabaseQueue and works great. Now, I'm starting to work on the background sync:
- Periodically, a background thread will request database updates from the server by calling a rest service
- A JSON payload will be returned with adds/updates/deletes for each table
- The background thread will process this JSON and update the local sqlite database
I attempted to create a separate instance of FMDatabaseQueue for the background sync, but I'm getting sporadic "database is locked" errors.
What's the best approach?
Thanks!
Jeff