gpt4 book ai didi

ios - 与文件应用程序共享应用程序文档中的特定目录

转载 作者:行者123 更新时间:2023-12-01 19:42:13 24 4
gpt4 key购买 nike

我创建了一个带有文件管理器的 iOS 应用程序,可以在 Documents 的子文件夹中浏览。
应用程序文档中的文件夹是:

  • 设置
  • 温度
  • 垃圾

  • 该应用程序的文件管理器仅在“根”文件夹内浏览。其他文件夹必须对用户隐藏且不可访问。

    我想与 iOS 自带的 Files App 共享“Root”文件夹,所以我在 info.plist 中添加了以下键:
    <key>UIFileSharingEnabled</key>
    <true/>
    <key>LSSupportsOpeningDocumentsInPlace</key>
    <true/>

    它有效,但所有文件夹都暴露了,我只想暴露“根”文件夹。

    是否可以在"file"应用中共享特定文件夹?

    非常感谢你。

    最佳答案

    在使用 iOS 文件系统之前,请检查 iOS 文件系统不同目录的使用情况。

    你可以引用这个链接:https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html

    根据上面的链接,苹果已经明确提到:

    对于 文件 目录:上面清楚地写着 this directory should only contain files that you may wish to expose to the user.
    enter image description here

    如果你想要一些不应该暴露给用户的东西,那么不要使用 Documents目录,而是使用 Library目录。

    对于 Library目录:Use the Library subdirectories for any files you don’t want exposed to the user. Your app should not use these directories for user data files.
    enter image description here

    在这里,请参阅上面链接中的以下屏幕截图,其中说明何时使用哪个目录?

    enter image description here

    简而言之,将根目录的内容保留在 Document 目录中,并将所有其他目录及其内容移至 Library 目录或 Library/Application Support 目录。因此,您的预期目的将得到实现。

    关于ios - 与文件应用程序共享应用程序文档中的特定目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53770864/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com