我正在尝试在文档选择器中选择多个文件。这是我的代码:
let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypeFolder)], in: .import)
documentPicker.delegate = self
self.present(documentPicker, animated: false) {
if #available(iOS 11.0, *) {
documentPicker.allowsMultipleSelection = true
}
}
但是它一次只选择1个文件。谁能建议我正确的方法?
任何帮助将不胜感激!
答案 0 :(得分:1)
先做
self.present
您的代码应为
let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypeFolder)], in: .import)
documentPicker.delegate = self
if #available(iOS 11.0, *) {
documentPicker.allowsMultipleSelection = true
}
self.present(documentPicker, animated: false) {
}
并检查“浏览”标签,而不是“收据”标签