【问题标题】:Content type/UTI to open CSV in app在应用程序中打开 CSV 的内容类型/UTI
【发布时间】:2011-10-06 15:20:37
【问题描述】:

如何编写 .plist 文件的 CFBundleDocumentTypes 属性,以允许应用程序显示在其他应用程序的“打开方式...”对话框中?

这是我的,但它不起作用

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array/>
        <key>CFBundleTypeName</key>
        <string>Readings</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>text.csv</string>
        </array>
    </dict>
</array>

【问题讨论】:

    标签: cocoa-touch csv plist uti


    【解决方案1】:

    找到它:public.comma-separated-values-text

    【讨论】:

    • 苹果的常量是kUTTypeCommaSeparatedText
    【解决方案2】:

    请考虑 Apple 提供的通用 UTI (here 图 1-2)。在您的情况下,public.text 应该足够了,但如果您还想处理 .doc 和 .docx 文件,您可能会对 public.composite-content 感兴趣。

    您的代码可能会修改如下

    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>Readings</string>
            <key>LSItemContentTypes</key>
            <array>
               <string>public.text</string>
               <string>public.html</string>
            </array>
        </dict>
    </array>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-23
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 2010-09-28
      • 1970-01-01
      • 2014-06-17
      • 2014-11-13
      相关资源
      最近更新 更多