无法从UIDocumentPickerViewController获取.doc文件ios swift

问题描述:

我正在使用此代码在我的应用程序中从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确认文档文件,但仍然无法获取文档文件。

根据this您必须使用com.microsoft.word.doc为文档类型 希望它的工作。

+1

这不提供问题的答案。一旦你有足够的[声誉](https://*.com/help/whats-reputation),你将可以[对任何帖子发表评论](https://*.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://*.com/review/late-answers/17657874) – Sand