UIDocumentPickerViewController选取文档后崩溃

时间:2019-06-20 11:17:52

标签: ios swift file ios13 uidocumentpickerviewcontroller

我目前正在研究macOs 10.15 beta 2,Xcode 11 beta 2,iPadOS 13 beta 2(iPad Air 2),

我已经在这样的选项卡视图中将UIDocumentPickerViewController添加为子viewController。

var controller : UIDocumentPickerViewController!
func addDocumentPickerController() {

    controller = UIDocumentPickerViewController(
        documentTypes: ["public.png"], // choose your desired documents the user is allowed to select
        in: .import // choose your desired UIDocumentPickerMode
    )
    controller.delegate = self
    controller.hidesBottomBarWhenPushed = true
    controller.allowsMultipleSelection = true

    self.view.addSubview(controller.view)
    let window = UIApplication.shared.keyWindow
    let topPadding = window?.safeAreaInsets.top

    self.controller.view.snp.makeConstraints { (make) in
        make.leading.equalToSuperview()
        make.trailing.equalToSuperview()
        make.top.equalTo(topPadding ?? 0)
        make.bottom.equalToSuperview()
    }
}

现在有代表

func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
}

此方法不会被调用。

仅在控制台错误下方。

[TraitCollection] Class _UIRootPresentationController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
[TraitCollection] Class UIPopoverPresentationController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
[TraitCollection] Class _UISheetPresentationController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
[TraitCollection] Class UIPreviewPresentationController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
[DocumentManager] The view service did terminate with error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
[DocumentManager] Remote view controller crashed with error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}. Trying to relaunch.

关于此的任何想法正在发生。

0 个答案:

没有答案