Unable to select multiple files using UIDocumentPickerViewController

I am trying to import / select multiple files at the same time from a file application using UIDocumentPickerViewController .

The trial setting allowsMultipleSelection = true , but there is no “ Select ” option while the picker is presenting.

Code snippet:

 UIDocumentPickerViewController *dvc = [[UIDocumentPickerViewController alloc]initWithDocumentTypes:arrContents inMode:UIDocumentPickerModeImport]; dvc.delegate = self; dvc.allowsMultipleSelection = true; [self presentViewController:dvc animated:true completion:nil]; 

Screenshot: enter image description here

+13
source share
1 answer

This is a bug that Apple needs to fix. You can use this workaround. If you set animated: to YES , it will only work the first time the document is displayed.

Objective-C:

 [self presentViewController:dvc animated:NO completion:^{ if (@available(iOS 11.0, *)) { dvc.allowsMultipleSelection = YES; } }]; 

Swift 4:

 self.present(dvc, animated: false) { if #available(iOS 11.0, *) { dvc.allowsMultipleSelection = true; } } 
+8
source

Source: https://habr.com/ru/post/1273045/


All Articles