gpt4 book ai didi

ios13 - UIDocumentPickerViewController iOS13 不工作

转载 作者:行者123 更新时间:2023-12-01 18:30:17 25 4
gpt4 key购买 nike

在我的应用程序中,我使用 UIDocumentPickerViewController 来允许用户选择文件(导入),但从 iOS 13 开始该功能停止工作,基本上文档选择器是打开的,但用户可以' t 选择一个文件(点击该文件不会执行任何操作)。

我做了一个简单的示例只是为了隔离代码:

class ViewController: UIViewController, UIDocumentPickerDelegate {

@IBAction func openDocumentPicker(_ sender: Any) {
let types = [String(kUTTypePDF)]
let documentPickerViewController = UIDocumentPickerViewController(documentTypes: types, in: .import)
documentPickerViewController.delegate = self
present(documentPickerViewController, animated: true, completion: nil)
}

func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
print("Cancelled")
}

func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
print("didPickDocuments at \(urls)")
}

}

示例项目: https://github.com/Abreu0101/document-picker-iOS13-issue

引用: enter image description here

最佳答案

当我遇到这个问题时,我意识到从“浏览”选项卡中选择文件时它可以工作,因为我实现了方法“didPickDocumentAt”,但当我点击“中的文件”时它不起作用最近”选项卡。

为了使其在“最近”选项卡上工作,我要实现方法“didPickDocumentsAt”,该方法实现相同的功能,但它处理URL 数组。

关于ios13 - UIDocumentPickerViewController iOS13 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57862786/

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