需要允许ppt文件被UIDocumentPicker选中
Need to allow ppt files to be selected by UIDocumentPicker
我需要允许 ppt、docx、xlsx 和 pdf 文件仅由我的应用程序中的文档选取器拾取。初始化文档选择器时需要设置哪些文档类型?
我在下面提到的代码中添加了几个类型,请检查它是否解决了您的问题:
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)
.
您可以尝试的其他可用类型:
"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"
如有任何问题请评论。
乐于助人!
我需要允许 ppt、docx、xlsx 和 pdf 文件仅由我的应用程序中的文档选取器拾取。初始化文档选择器时需要设置哪些文档类型?
我在下面提到的代码中添加了几个类型,请检查它是否解决了您的问题:
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)
.
您可以尝试的其他可用类型:
"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"
如有任何问题请评论。
乐于助人!