16

VC "B" öğesini genel olarak sunan bir VC "A" var. B UIDocumentMenuViewController UIDocumentMenuDelegate protokol En kısa sürede B'nin dismiss(animated:completion:) çağrılan ve ben neden hiçbir ipucu çağrılan documentMenuWasCancelled(_ documentMenu:) veya documentMenu(_:didPickDocumentPicker:) olarak B.UIDocumentMenuViewController, görüntüleme denetleyicisini reddetti

yılında

uygulanmaktadır sunar. Eğer ben uygulamaya temsilci işlevinde hiçbir şey görebileceğiniz gibi

İşte benim kod

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") 
} 

bu. Ve hala B işten çıkarıldı. Anlamadım.

+0

Projenin daha fazlasını veya en azından orada sahip olduğunuz ViewControllers'a gönderebilir misiniz? –

+0

Aslında şu anda yeniden üretemiyorum: D – lukwuerz

+0

her iki denetleyicinin nasıl sunulduğuna dair bir sorun olabilir .. –

cevap

0

Bu, bir eylemi tıklattığınızda veya UIDocumentMenuViewController'u iptal ettiğiniz zaman çağrılan documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) yönteminden kaynaklanır. o yardımcı olur https://stackoverflow.com/a/45505488/6381503

Hope:

Burada bir çözüm yayınlanmıştır.

İlgili konular