你好 我已经设法通过向项目构建添加文档类型来打开.xls文件形式的邮件应用程序,并将Types字段设置为“com.microsoft.excel.xls”(参见屏幕截图)。 我想对xlsx文件做同样的事但不能这样做。我试图添加“com.microsoft.excel.xlsx”但它没有用
我通过如下定义自定义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>
....
<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>
XLSX已声明为org.openxmlformats.presentationml.presentation
XLSX文件的标识符是org.openxmlformats.spreadsheetml.sheet