我可以检查 QuickLook support/opens 给定的文件吗?

Can I check if QuickLook support/opens given file?

我正在使用 Quick Look Framework 进行附件预览,需要在启动 QLPreviewController 之前标记不支持的文件。我能否以编程方式检查 QuickLook 是否真的会预览文件以及如何预览文件?

您可以使用 QLPreviewController 中的 canPreviewItem 属性 检查项目是否可以被 QLPreviewController 预览

顺便说一句,这些是 QLPreviewController(Ref)

支持的文件

iWork documents

Microsoft Office documents (Office ‘97 and newer)

Rich Text Format (RTF) documents

PDF files

Images

Text files whose uniform type identifier (UTI) conforms to the public.text type (see Uniform Type Identifiers Reference)

Comma-separated value (csv) files