gpt4 book ai didi

ios - swift 在 UIDocumentPicker 中设置文档扩展名

转载 作者:可可西里 更新时间:2023-11-01 01:56:52 25 4
gpt4 key购买 nike

我正在使用文档选择器来选择文档并上传到服务器。我只需要为允许的文件传递一些扩展名,但我无法找出什么扩展名代表什么类型的文件。这是我想要允许的扩展列表。 -docx-Microsoft Word - xlsx - Microsoft Excel - pptx - Microsoft Powerpoint - PDF -csv - 页面 - 数字 - 关键 - 基调 - RTF - 文本我知道一些扩展名,如“kUTTypePDF、kUTTypeRTF”,但不是所有的都请帮助。

最佳答案

swift 5.0

let types = [kUTTypePDF, kUTTypeText, kUTTypeRTF, kUTTypeSpreadsheet] // You can add more types here as pr your expectation
let importMenu = UIDocumentPickerViewController(documentTypes: types as [String], in: .import)

试试这个

如果要选择所有文件,则必须使用以下代码:

let documentPicker = UIDocumentPickerViewController(documentTypes: ["com.apple.iwork.pages.pages", "com.apple.iwork.numbers.numbers", "com.apple.iwork.keynote.key","public.image", "com.apple.application", "public.item", "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"], in: .import)

关于ios - swift 在 UIDocumentPicker 中设置文档扩展名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52070937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com