iOS iTunes 文件共享问题

发布于 2024-11-15 00:52:44 字数 122 浏览 4 评论 0 原文

我有一个 iOS 应用程序,它使用文件共享为用户提供几个下载的文件。这很好用,但有几个文件我不希望用户访问。

我可以提供 iTunes 可以从中获取数据的自定义文件夹吗?或者我可以采取什么措施来防止这些文件被访问?

I have an app for iOS that uses Filesharing to provide the user with a couple of downloaded files. This works great, but there are a couple of files that I don't want the user to have access to.

Can I provide a custom folder where iTunes can get the data from or what can I do to prevent these files from being accessed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蘑菇王子 2024-11-22 00:52:45

来自与用户共享文件 部分:

重要提示:在 iTunes 中,用户可以
仅操作中的顶级项目
文档目录。用户不能
查看子目录的内容但是
可以删除这些目录或复制
将其内容复制到桌面。拿
决定时要考虑到这一点
在此目录中放置文件的位置。

因此,启用文件共享后,您无法隐藏“文档”文件夹中的文件 - 您应该将其放在应用程序沙箱中的另一个文件夹中:

如果您不想共享文件
与用户一起,将他们放入您的
应用程序的库目录。如果
没有标准库
子目录合适,创建
图书馆内的私人目录
目录并为其指定名称
应用程序的包 ID。那么你可以
使用该目录来存储任何文件
对于您的应用程序来说是私有的。

From Sharing Files with the User section from docs:

Important: In iTunes, users can
manipulate only the top-level items in
the Documents directory. Users cannot
see the contents of subdirectories but
can delete those directories or copy
their contents to the desktop. Take
this into consideration when deciding
where to put files in this directory.

So with File sharing enabled you cannot hide files in Documents folder - you rather should put it in another folder in application sandbox:

If you do not want files to be shared
with the user, put them in your
application’s Library directory. If
none of the standard Library
subdirectories are appropriate, create
a private directory inside the Library
directory and give it the name of your
application’s bundle ID. You can then
use that directory to store any files
that are private to your application.

如梦初醒的夏天 2024-11-22 00:52:44

您可以将要从文件共享中排除的文件放入Library(子文件夹)或Caches文件夹中。资料库将使用 iTunes 进行备份,而缓存则不会。

You can put the files you want to exclude from filesharing either in (a subfolder in) Library or Caches Folder. Library will be backuped with iTunes, Caches not.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文