文档选择器控制器的多项选择

Multiple selection for document picker controller

我正在尝试 select 文档选择器中的多个文件。这是我的代码:

let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypeFolder)], in: .import)
documentPicker.delegate = self
self.present(documentPicker, animated: false) {
    if #available(iOS 11.0, *) {
        documentPicker.allowsMultipleSelection = true
    }
}

但它一次只 select 处理 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) {

        }

并在浏览选项卡中检查,而不是在 Recenets 选项卡中检查