Where should I store the SQLite DB for my iPhone app?

前端 未结 3 1136
我寻月下人不归
我寻月下人不归 2021-02-02 13:19

I have several iOS apps on the market and in all of them I have a small SQLite database file connected to the app to provide the user with my data. Once installed the user custo

3条回答
  •  爱一瞬间的悲伤
    2021-02-02 13:39

    Apple's file system programming guide for iOS describes the (application_home)/Library path as a place to "create custom subdirectories for files you want backed up but not exposed to the user". The (application_home)/Documents path is described as "the contents of this directory can be made available to the user through file sharing."

    Your databases don't sound like documents, they sound like private caches that users shouldn't know about. I recommend you create a directory such as (application_home)/Library/Database and save files there. The cache path you mention doesn't sound like the best option to me.

    You should really review the entire file system programming guide for iOS before submitting another app.

提交回复
热议问题