我目前正在开发 macOS 10.15 beta 2、Xcode 11 beta 2、iPadOS 13 beta 2 (iPad Air 2)、
我已将 UIDocumentPickerViewController 添加为像这样的 tabview 中的子 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.
任何想法都在发生。