iPhone文档目录和UIFileSharingEnabled,隐藏某些文档
我希望用户能够访问文档目录中的文件,但正在使用核心数据,并且不希望用户能够访问存储(sqllite db),我可以在仍然允许文件共享的情况下对用户隐藏它吗,或者我可以将其放在另一个仍会备份的目录中吗?
I want the user to be able to access the files in the documents directory but am using core data and dont want the user to be able to access the store (the sqllite db), can i hide it from the user while still allowing file sharing, or can i put it in another directory where it will still get backed up?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
FrenchKiss Dev给出的答案不正确。用户仍然可以在 iTunes 中看到“.data”目录,并将其及其内的所有文件保存在本地。
相反,请将私有文档存储在
Library/Preferences
根据苹果的说法:
The answer given by FrenchKiss Dev is not correct. The user will still be able to see the ".data" directory in iTunes and save that locally with all the files inside it.
Instead, store private documents in
Library/Preferences
According to Apple:
在文档目录中,创建一个名称以点开头的子目录。例如:
编辑:请停止降级此答案!
这个答案在当时是正确的(记住那是在 iPad 真正可用之前!而且在这个问题上有很多困惑,我们仍然希望 iPad 出现在 Finder 的共享设备中......) .
今天(2012 年 4 月)它仍然可以在 Mac 上运行,但不能在 Windows 上运行(以点开头的目录名称在 Windows 中没有任何意义)。
无论如何,这个共享文档功能是一团糟。后来他们修复了这个问题,说“私人文档”应该存储在库文件夹中,而不是文档文件夹中。但请记住,在 iPad 出现之前,开发人员就已经在使用 Document 文件夹了。
不要因为苹果的错误而责怪我。
Stack Overflow 应该有一种方法将答案标记为已过时。
API 发生变化、得到修复,从而使答案变得过时。
In the documents directory, create a subdirectory which name starts with a dot. For example:
EDIT: Please stop downgrading this answer !
This answer was correct at the time (remember that it was before the iPad was actually available! And there was a lot of confusion on the matter, we were still hoping for the iPad to appear in the shared devices in the Finder...).
Today (April 2012) it is still working on the Mac but not on Windows (starting a directory name with a dot means nothing in Windows).
Anyway, this Shared Document feature is a mess. Later they fixed it by saying that "Private Documents" should be stored in the Library Folder not in the Documents folder. But remember that developers were already using the Document folder before the iPad came.
Don't blame me for Apple mistakes.
Stack Overflow should have a way to mark an answer as obsolete.
API changes, get fixed, and it renders answers obsolete.