What different between store database in different locations in iOS?

走远了吗. 提交于 2019-11-30 23:06:17

The main difference is that storing the file in the documents folder means you can write (update) it, which is pretty important for a database file. You cannot write to a file in the app bundle.

The usual pattern for using a database in an app is:

  1. Create a pre-seeded database during development and copy it to the app bundle during building.
  2. When running, check if the database file exists and is up-to-date in the documents folder.
  3. If not, copy it from the app bundle.
  4. Open the database in the documents folder and read/write as desired.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!