如何解决UIDocumentPickerViewController 不响应在 iOS 13 和 iOS 14 上选择的文档
我正在尝试在我的应用程序中实现 documentPicker,但在选择 PDF 文件时它什么也不做 我看着那些 answers 和 this 和 我试图在 ios13.0 和 ios14.4 上运行它,也是在 iOS 14.4 上运行的物理设备,但它不起作用
我正在使用 macOS Big Sur 11.2.3 / Xcode 12.4
@objc func uploadDocumentTapped() {
let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypePDF)],in: .import)
documentPicker.delegate = self
documentPicker.modalPresentationStyle = .formSheet
self.dismiss(animated: true) { //dismiss presentation Controller
let top = UIApplication.shared.keyWindow?.rootViewController
top?.present(documentPicker,animated: true,completion: nil)
}
}
extension UploadDocumentMenuViewController: UIDocumentPickerDelegate {
func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
print("cancelled")
}
func documentPicker(_ controller: UIDocumentPickerViewController,didPickDocumentsAt urls: [URL]) {
print("URL Documents \(urls)")
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。