0

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

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

但它一次只选择一个文件。谁能给我一个正确的方法?

任何帮助将不胜感激!

4

1 回答 1

4

只做之前

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 选项卡

于 2019-06-02T15:51:06.963 回答