我有一个应用程序,用户可以在其中使用文件管理器来创建、修改和删除目录以及文件。我注意到,从外部应用程序导入文件时,会自动生成系统文件夹 Inbox
,防止用户删除该文件夹和/或命名名为 Inbox
的文件夹。我是否应该在文档路径目录中创建一个子目录,并让文件管理器将该文件夹视为文档根路径?其他应用程序如何实现这一目标?
最佳答案
如果您允许用户在沙箱的文档目录中创建自己的文档和目录,那么最好按照您的建议进行操作,并在文档中创建一个单独的目录,指定用于用户可编辑的数据。
例如,也许在文档中添加一个“用户”目录,然后将其用作用户文件和目录的根目录。
Apple 的文档对/Documents/Inbox 进行了以下说明:
Use this directory to access files that your app was asked to open by outside entities. Specifically, the Mail program places email attachments associated with your app in this directory. Document interaction controllers may also place files in it. Your app can read and delete files in this directory but cannot create new files or write to existing files. If the user tries to edit a file in this directory, your app must silently move it out of the directory before making any changes. The contents of this directory are backed up by iTunes.
关于swift - 如果我希望允许用户管理文件夹和文件,我该如何处理文档目录中的收件箱文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37035430/