如果我希望允许用户管理文件夹和文件,我该如何处理文档目录中的收件箱文件夹?
What do I do with the Inbox folder in the Documents Directory if I want the User to Be Allowed to Manage Folders and Files?
我有一个应用程序,用户可以在其中使用文件管理器来创建、修改和删除目录以及文件。我注意到当从外部应用程序导入文件时,系统文件夹 Inbox
会自动生成,以防止用户同时删除文件夹 and/or 并命名一个名为 Inbox
的文件夹。我是否应该在文档路径目录中创建一个子目录,并让文件管理器将该文件夹视为文档根路径?其他应用如何实现这一点?
如果您允许用户在 Sandbox 的文档目录中创建他们自己的文档和目录,那么最好按照您的建议进行操作,并在文档中创建一个单独的目录,该目录将指定用于用户可编辑的数据。
例如,可以在Documents中添加一个'User'目录,然后将其作为用户文件和目录的根目录。
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.
我有一个应用程序,用户可以在其中使用文件管理器来创建、修改和删除目录以及文件。我注意到当从外部应用程序导入文件时,系统文件夹 Inbox
会自动生成,以防止用户同时删除文件夹 and/or 并命名一个名为 Inbox
的文件夹。我是否应该在文档路径目录中创建一个子目录,并让文件管理器将该文件夹视为文档根路径?其他应用如何实现这一点?
如果您允许用户在 Sandbox 的文档目录中创建他们自己的文档和目录,那么最好按照您的建议进行操作,并在文档中创建一个单独的目录,该目录将指定用于用户可编辑的数据。
例如,可以在Documents中添加一个'User'目录,然后将其作为用户文件和目录的根目录。
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.