无法使用UIDocumentPickerViewController选择多个文件

Ana*_*ore 13 objective-c ios uidocumentpickervc

我正在尝试使用文件应用程序一次导入/选择多个文件UIDocumentPickerViewController.

尝试设置,allowsMultipleSelection = true但在呈现选择器时仍然没有" 选择 "选项.

代码段:

UIDocumentPickerViewController *dvc = [[UIDocumentPickerViewController alloc]initWithDocumentTypes:arrContents inMode:UIDocumentPickerModeImport];
dvc.delegate = self;
dvc.allowsMultipleSelection = true;
[self presentViewController:dvc animated:true completion:nil];
Run Code Online (Sandbox Code Playgroud)

截图: 在此输入图像描述

Wet*_*ish 8

这是Apple需要修复的错误.您可以使用此解决方法.如果设置animated:YES,则仅在您第一次显示文档选择器时才会起作用.

Objective-C的:

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

斯威夫特4:

self.present(dvc, animated: false) {
    if #available(iOS 11.0, *) {
        dvc.allowsMultipleSelection = true;
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 事实证明这是一种行为改变。请参阅“iOS”部分,此处:https://github.com/DelphiWorlds/Kastri/blob/master/Demos/FilesSelector/ReadMe.md (3认同)
  • 有时,您需要在“最近”和“浏览”之间切换,然后才能在iPad上看到“选择”按钮。如果将文档选择器显示为表单,则应该立即可见。 (2认同)
  • 但这确实需要苹果来解决。我已经提交了雷达。你也应该这样! (2认同)
  • iOS 14 上怎么还没解决这个问题!?另外,答案似乎不适用于 iOS 14... (2认同)
  • 14.2 上也不适合我 (2认同)