How to properly call SQLite functions from background thread on iPhone?

前端 未结 8 2015
礼貌的吻别
礼貌的吻别 2020-12-29 15:10

I\'m using an SQLite database in my iPhone app. At startup, there are some database actions that I want to perform in a separate thread. (I\'m doing this mainly to minimize

8条回答
  •  春和景丽
    2020-12-29 16:01

    If you want to use SQLite on multiple threads with no restrictions, do the following before opening your connection:

    sqlite3_shutdown();
    sqlite3_config(SQLITE_CONFIG_SERIALIZED);
    sqlite3_initialize();

    http://www.sqlite.org/threadsafe.html

提交回复
热议问题