Need to allow ppt files to be selected by UIDocumentPicker

早过忘川 提交于 2020-04-18 05:45:52

问题


I need to allow ppt,docx, xlsx and pdf files only to be picked up by document picker in my application. What I need to set as document types when I initialize my document picker?


回答1:


I have added couple of types in the below mentioned code, please check if it solves your issue:

let types: [String] = [kUTTypePDF as String,kUTTypeSpreadsheet as String, kUTTypePresentation as String, "com.apple.iwork.pages.pages", "public.text"]
let documentPicker = UIDocumentPickerViewController(documentTypes: types, in: .import)
documentPicker.delegate = self
documentPicker.modalPresentationStyle = .formSheet
self.present(documentPicker, animated: true, completion: nil)

.

Other available types which you can try:

"com.apple.iwork.pages.pages", "com.apple.iwork.numbers.numbers", "com.apple.iwork.keynote.key","public.image", "com.apple.application", "public.item","public.data", "public.content", "public.audiovisual-content", "public.movie", "public.audiovisual-content", "public.video", "public.audio", "public.text", "public.data", "public.zip-archive", "com.pkware.zip-archive", "public.composite-content", "public.text", " "com.microsoft.word.doc"

Please comment if you have any question.

Happy to help!



来源:https://stackoverflow.com/questions/61118397/need-to-allow-ppt-files-to-be-selected-by-uidocumentpicker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!