您好
我通过向项目构建添加文档类型并将Types字段设置为"com.microsoft.excel.xls"(参见屏幕截图),设法通过邮件应用程序打开.xls文件.
我想对xlsx文件做同样的事但不能这样做.我试图添加"com.microsoft.excel.xlsx",但它没有用

小智 16
我通过如下定义自定义UTI解决了这个问题.尝试将这些定义添加到info.plist中.它按预期工作.
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeDescription</key>
<string>XLSX input table document</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>xlsx</string>
<key>public.mime-type</key>
<string>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</string>
</dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.mydomain.myapplication.xlsx</string>
</dict>
</array>
Run Code Online (Sandbox Code Playgroud)
....
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>XLSX input table document</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>com.mydomain.myapplication.xlsx</string>
</array>
</dict>
</array>
Run Code Online (Sandbox Code Playgroud)
XLSX 文件的标识符是org.openxmlformats.spreadsheetml.sheet
结账: https: //escapetech.eu/manuals/qdrop/uti.html