Search code examples
iosswiftuidocumentpickerviewcontrollerfiles-app

Missing "Select" option to select multiple files in UIDocumentPickerViewController


Does anyone know why there is no Select option when tapping 3 dots in UIDocumentPickerViewController like it is in a Files app? Even if multipleSelection is set to true.
I noticed that it appears on simulator, but not on the real device.

private lazy var _documentPicker = UIDocumentPickerViewController(documentTypes: ["public.image",
         "public.audio",
         "public.movie",
         "public.text",
         "public.item",
         "public.content",
         "public.source-code"],
        in: .import)

private final func performDocumentsMenuOpen() {
        present(self._documentPicker, animated: true) {
            if #available(iOS 11.0, *) {
                self._documentPicker.allowsMultipleSelection = true
            } else {
                // Fallback on earlier versions
            }
        }
    }

img


Solution

  • Fixed by

    • moving allowsMultipleSelection = true before presenting documentPicker
    • changing animated to false in present(self._documentPicker, animated: true)