使用UIDocumentPickerViewController导入文档警告"fileprovider插件已失效"

6 uikit ios swift

无论何时我通过导入文档UIDocumentPickerViewController,我都会看到一条消息记录到控制台:

TestApp[66587:1550086] plugin com.apple.UIKit.fileprovider.default invalidated
Run Code Online (Sandbox Code Playgroud)

这是否意味着我的代码有问题?或者这只是一个预期的警告?无论如何要抑制它吗?


@IBAction func attachFile(sender: UIButton) {
    let documentPicker = UIDocumentPickerViewController(documentTypes: ["public.image"], inMode: .Import)
    documentPicker.delegate = self
    self.presentViewController(documentPicker, animated: true, completion: nil)
}

func documentPicker(controller: UIDocumentPickerViewController, didPickDocumentAtURL url: NSURL) {
}
Run Code Online (Sandbox Code Playgroud)

小智 0

我正在使用 xcode 8.3.2 和 swift 3.0...这是我的代码...它运行良好..只需调用 openDocumentPicker() 我希望它对您有帮助

extension AddCaseStep3ViewController : UIDocumentMenuDelegate,UIDocumentPickerDelegate{
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
    let url = url as URL

    //this is the url of your doc you can send enjoy!!
}

@available(iOS 8.0, *)
public func documentMenu(_ documentMenu:     UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {

    documentPicker.delegate = self
    present(documentPicker, animated: true, completion: nil)

}

func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
    //dismiss(animated: true, completion: nil)
}

func openDocumentPicker(){
    //
    let documentPicker = UIDocumentPickerViewController(documentTypes: ["public.content","public.data","kUTTypePDF"], in: .import)
    documentPicker.delegate = self
    documentPicker.modalPresentationStyle = .formSheet
    self.present(documentPicker, animated: true, completion: nil)
}}
Run Code Online (Sandbox Code Playgroud)