ios11文件夹

File Manager

UIDocumentBrowserViewController

多了一个文件管理的 VC,默认里面会显示当前 app 权限之内的文件,包括本地的和存在 iCloud 的.

若是三方 app 在 info.plist 中声明了 UISupportsDocumentBrowser 或者 UIFileSharingEnabled 和 LSSupportsOpeningDocumentsInPlace 的话,能够得到第三方 app 的文件。

构造方法以下该构造还提供了文件筛选的能力:

 UIDocumentBrowserViewController* view = [[UIDocumentBrowserViewController alloc] initForOpeningFilesWithContentTypes:@[@".txt",@".pages",@".pdf"]];

在使用该 VC 时务必把文件管理里的 VC 做为应用的 根 VC,不要把它放在 navigation,tab 或者 split 视图中,也不要经过模态的样式展示出来。

有上述需求的话用 UIDocumentPickerViewController 来替代

因为文件可能被任何 app 中的 UIDocumentBrowserViewController 修改,因此对文件的操做尽可能经过 UIDocument 子类 或者 NSFilePresenter 和 NSFileCoordinator 对象来操做。

相关文章
相关标签/搜索