How can I import multiple files at the same time using UIDocumentPickerViewController?
2 answers
Use the following code snippet, this will add a Select button next to the header to select multiple files at once and import them.
UIDocumentPickerViewController *dvc = [[UIDocumentPickerViewController alloc]initWithDocumentTypes:arrContents inMode:UIDocumentPickerModeImport];
dvc.delegate = self;
[self presentViewController:dvc animated:true completion:^{
if (@available(iOS 11.0, *)) {
dvc.allowsMultipleSelection = true;
}
}];
and
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray <NSURL *>*)urls
to get a list of the selected files.
+1
source to share