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

时间:2017-05-12 14:26:40

标签: ios swift uti uidocumentpickervc

我使用此代码在我的应用中从iCloud获取文档。

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。我能够从icloud获取PDF文件而不是.doc文件 我为文件类型提供了正确的UTI,即" public.content"," public.data"。这些UTI在页面上给出 apple Documentation。 public.data确认了doc文件,但我仍然无法获取doc文件。

1 个答案:

答案 0 :(得分:2)

根据this,您必须将 com.microsoft.word.doc 用于文档类型 希望它有效。