2017-05-12 67 views
0

我正在使用此代碼在我的應用程序中從iCloud獲取文檔。無法從UIDocumentPickerViewController獲取.doc文件ios swift

let documentPicker: UIDocumentPickerViewController = UIDocumentPickerViewController(documentTypes: ["public.content","public.data"], in: UIDocumentPickerMode.import) 
    documentPicker.delegate = self 
    documentPicker.modalPresentationStyle = UIModalPresentationStyle.fullScreen 
    if let popoverPresentationController = documentPicker.popoverPresentationController { 
     popoverPresentationController.sourceView = sender 
    } 

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

我想從iCloud獲得三種類型的文檔,即.pdf,.doc,.docx。我能夠獲得PDF文件,但不能從icloud獲得.doc文件。我爲文件類型提供了適當的UTI,即「public.content」,「public.data」。這些UTI在這裏給出在頁 apple Documentation。 public.data確認文檔文件,但仍然無法獲取文檔文件。

回答

2

根據this您必須使用com.microsoft.word.doc爲文檔類型 希望它的工作。

+1

這不提供問題的答案。一旦你有足夠的[聲譽](https://stackoverflow.com/help/whats-reputation),你將可以[對任何帖子發表評論](https://stackoverflow.com/help/privileges/comment);相反,[提供無需澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-c​​an -i-do-instead) - [來自評論](https://stackoverflow.com/review/late-answers/17657874) – Sand