【问题标题】:Importing files in iOS : UIDocumentPicker vs UIDocumentBrowser在 iOS 中导入文件:UIDocumentPicker 与 UIDocumentBrowser
【发布时间】:2018-09-10 18:07:43
【问题描述】:

根据文档,UIDocumentPickerViewControllerUIDocumentBrowserViewController 都可用于在应用沙箱外导入文档。

对于从本地文档提供者/云位置选择和导入文档,上述哪个最适合。我仍然可以在 iOS 11 中使用 UIDocumentPickerViewController 吗?

根据以下文档Apple documentation for document picker,在您的应用程序可以使用文档选择器之前,您必须在 Xcode 中打开 iCloud 文档功能,并且应将 iCloud 容器映射到 appId。如果我只是做进口操作?我曾尝试使用 UIDocumentPickerViewController,即使没有上述权利,它似乎也能正确返回选定的文件路径。

【问题讨论】:

    标签: ios ios11 uidocumentpickerviewcontroller uidocumentbrowservc fileprovider-extension


    【解决方案1】:

    如果您不需要自己的 iCloud 容器,则不需要该权利。如果你只是想导入文件,你可以使用UIDocumentPickerViewController而不添加授权。

    是的,UIDocumentPickerViewController 适用于 iOS 11。

    【讨论】:

      【解决方案2】:

      UIDocumentBrowserViewController 必须是您的应用程序的根视图,因此根据我的经验,您不能在现有应用程序中使用并成为 NavigationControl 的一部分(您将无法正确获取后退按钮)。在这些情况下,我们需要使用 UIDocumentPickerViewController。希望这会有所帮助。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-07-21
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多