您好,我已经通过向项目构建添加文档类型并将Types字段设置为“com.microsoft.excel.xls”(请参阅屏幕截图),通过邮件应用程序打开.xls文件.
我想对xlsx文件做同样的处理,但不能做.我尝试添加“com.microsoft.excel.xlsx”但是没有起作用
我想对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>