16

VC "B"をモーダルに表示するVC "A"があります。 BはUIDocumentMenuViewController UIDocumentMenuDelegateプロトコルはできるだけ早くBのdismiss(animated:completion:)が呼び出されると、私はなぜか見当もつかない呼び出されるdocumentMenuWasCancelled(_ documentMenu:)またはdocumentMenu(_:didPickDocumentPicker:)としてB.UIDocumentMenuViewControllerプレゼンテーションコントローラを表示しない

を実装されて提示します。あなたは私が実装デリゲート機能で何もしない見ることができるように

は、ここに私のコード

func presentDocumentPicker() { 
    let documentTypes = [ 
     kUTTypeCompositeContent as String, 
     kUTTypePDF as String, 
     "com.microsoft.word.doc", 
     "vnd.openxmlformats-officedocument.wordprocessingml.document" 
    ] 
    let documentMenuViewController = UIDocumentMenuViewController(documentTypes: documentTypes, in: .import) 
    documentMenuViewController.delegate = self 
    present(documentMenuViewController, animated: true, completion: nil) 
} 

// MARK: - Document Menu View Controller Delegate 

func documentMenu(_ documentMenu: UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) { 
    print("did pick") 
} 

func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) { 
    print("was cancelled") 
} 

です。それでもBは解雇される。理解できません。

+0

あなたはそこにいるViewControllersに、さらに多くのプロジェクトを送ることができますか? –

+0

実際には今、私はそれを再現することができません:D – lukwuerz

+0

両方のコントローラを提示する方法の問題があるかもしれません.. –

答えて

0

これは、アクションをクリックしたとき、またはキャンセルするときに呼び出されるdocumentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL)メソッドによって発生します。UIDocumentMenuViewController

私はここで解決策を掲載:https://stackoverflow.com/a/45505488/6381503

はそれがお役に立てば幸いです。

関連する問題