在哪里存储核心数据文件? [英] Where to store the Core Data file?

查看:144
本文介绍了在哪里存储核心数据文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS模板的默认Core Data将数据存储在 NSDocumentDirectory 中的 .sqlite 文件中。

The default Core Data for iOS template stores data in an .sqlite file in the NSDocumentDirectory. The file is therefor visible if the iDevice is connected to iTunes and file sharing is enabled.

我想将目录更改为用户不可见的内容,并且我会选择 NSApplicationSupportDirectory 。这是正确的目录吗?

I would like to change the directory to something that is not visible to the user and I would choose the NSApplicationSupportDirectory. Is this the correct directory? What do other developers use?

推荐答案

最好的地方(iPhone上)是Library文件夹,如下所述:

The best place (on the iPhone) is the Library folder, as described here:

如何在iPhone上获得可写入的路径?

该目录适用于您不希望用户能够访问的数据库见分享。

That directory is meant for things like databases that you do not want the user to be able to see through sharing.

这篇关于在哪里存储核心数据文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆