Using transactions to insert is throwing errors Sqlite.swift

陌路散爱 提交于 2019-12-06 12:07:05

Your func createTable() and func addRow() methods are not thread safe. Multiple threads can access it at the same time.

Create a private serial DispatchQueue inside your Singleton class and do above functions through this serial queue. This will prevent accessing the database from several threads at the same time, and serial queue will queue concurrent tasks.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!