xcode4 – 如何将excel文件类型(xlsx)与iPhone应用程序相关联

您好,我已经通过向项目构建添加文档类型并将Types字段设置为“com.microsoft.excel.xls”(请参阅​​屏幕截图),通过邮件应用程序打开.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>

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...