【问题标题】:Swift 4.2 UIDocumentBrowser View Controller Powerpoint PPTX files greyed outSwift 4.2 UIDocumentBrowser View Controller Powerpoint PPTX 文件灰显
【发布时间】:2019-02-25 10:45:09
【问题描述】:

我在带有 Swift 的 Xcode 10.1 中使用基于文档的应用程序模板。开箱即用,它不支持许多文件类型,因此我添加了许多文档类型,包括各种 Microsoft Office 格式(doc、xls、ppt),它们可以正常工作。我还为 docx、xlsx 和 pptx 添加了开放的 xml 格式。这些也可以正常工作,除了 pptx 在运行应用程序时保持灰色。我也尝试过使用导入的 UTI 部分,但没有成功。这是 Info.plist 的摘录,显示了 docx 和 xlsx 条目(有效)以及等效的 pptx 条目无效。

这些工作:

 <dict>
    <key>CFBundleTypeIconFiles</key>
    <array/>
    <key>CFBundleTypeName</key>
    <string>wordx</string>
    <key>CFBundleTypeRole</key>
    <string>Viewer</string>
    <key>LSHandlerRank</key>
    <string>Alternate</string>
    <key>LSItemContentTypes</key>
    <array>
        <string>org.openxmlformats.wordprocessingml.document</string>
    </array>
</dict>
<dict>
    <key>CFBundleTypeIconFiles</key>
    <array/>
    <key>CFBundleTypeName</key>
    <string>excelx</string>
    <key>CFBundleTypeRole</key>
    <string>Viewer</string>
    <key>LSHandlerRank</key>
    <string>Alternate</string>
    <key>LSItemContentTypes</key>
    <array>
        <string>org.openxmlformats.spreadsheetml.sheet</string>
    </array>
</dict>

虽然不是这样:

    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array/>
        <key>CFBundleTypeName</key>
        <string>powerx</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHanderRank</key>
        <string>Default</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>org.openxmlformats.presentationml.presentation</string>
        </array>
    </dict>

我也尝试过导入的 UTI,但没有成功:

<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.content</string>
</array>
<key>UTTypeDescription</key>
<string>powerpoint pptx</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>org.openxmlformats.presentationml.presentation</string>
<key>UTTypeTagSpecification</key>
<array>
<string>pptx</string>
<string>application/vnd.openxmlformats-officedocument.presentationml.presentation</string>
</array>
</dict>
</array>

任何帮助将不胜感激,谢谢。

【问题讨论】:

    标签: swift xcode uti uidocumentbrowservc


    【解决方案1】:

    根据文档here,ppt 文件的 UTI 标识符是 com.microsoft.powerpoint.​ppt

    所以你可以试试:

    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array/>
        <key>CFBundleTypeName</key>
        <string>powerx</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHanderRank</key>
        <string>Default</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.microsoft.powerpoint.​ppt</string>
        </array>
    </dict>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多