【问题标题】:How do I get my app to show up in the "Open In..." popover list in the iPad? [duplicate]如何让我的应用程序显示在 iPad 的“打开方式...”弹出列表中? [复制]
【发布时间】:2011-09-17 19:56:13
【问题描述】:

可能重复:
How do I associate file types with an iPhone application?

经过一番谷歌搜索,我发现我要更改我的 plist 文件以包含“文档类型”---> 一个数组,每个位置都有两个值:文档类型名称、处理程序等级。

我这样做并写了 public.pdf、public.png 等...作为文档类型名称,我尝试了每个可用的处理程序等级。但是,当我在 iPad 上测试它时,我的应用仍然不会显示在“打开方式...”列表中。

谁能帮我实现这个目标?

【问题讨论】:

    标签: ipad plist documents


    【解决方案1】:

    我没有测试过,但这对你有用吗?

    另见以下链接:http://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/understanding_utis/understand_utis_declare/understand_utis_declare.html

    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>pdf</string>
            </array>
            <key>CFBundleTypeIconFile</key>
            <string>app.icns</string>
            <key>CFBundleTypeName</key>
            <string>public.pdf</string>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.pdf</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>png</string>
            </array>
            <key>CFBundleTypeIconFile</key>
            <string>app.icns</string>
            <key>CFBundleTypeName</key>
            <string>public.png</string>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.png</string>
            </array>
        </dict>
    </array>
    

    还有这个……

    <key>UTImportedTypeDeclarations</key>
    <array>
        <dict>
            <key>UTTypeConformsTo</key>
            <array>
                <string>public.data</string>
            </array>
            <key>UTTypeIdentifier</key>
            <string>public.pdf</string>
            <key>UTTypeTagSpecification</key>
            <dict>
                <key>com.apple.ostype</key>
                <string>PDF</string>
                <key>public.filename-extension</key>
                <array>
                    <string>pdf</string>
                </array>
                <key>public.mime-type</key>
                <string>application/pdf</string>
            </dict>
        </dict>
        <dict>
            <key>UTTypeConformsTo</key>
            <array>
                <string>public.image</string>
            </array>
            <key>UTTypeIdentifier</key>
            <string>public.png</string>
            <key>UTTypeTagSpecification</key>
            <dict>
                <key>com.apple.ostype</key>
                <string>PNG</string>
                <key>public.filename-extension</key>
                <array>
                    <string>png</string>
                </array>
                <key>public.mime-type</key>
                <string>image/png</string>
            </dict>
        </dict>
    </array>
    

    【讨论】:

    • 感谢您的回答! - 我会试一试,但你把这段代码放在哪里了?
    • 在文本编辑器(例如 TextWrangler)中打开您的 .plist 文件并将其粘贴到您现有的 &lt;key&gt;CFBundleDocumentTypes&lt;/key&gt; 和紧随其后的 &lt;array&gt; ... &lt;/array&gt; 的位置。认为这比尝试在 Xcode 中使用界面更容易。
    • 它告诉我文件已损坏,无法读取...
    • 对不起,那是因为我错过了中间的&lt;/dict&gt;。只需重新复制代码。
    • 我重新复制了代码 - 并且没有错误了 - 顺便说一句,这很漂亮,不知道你可以在文本编辑器中做到这一点,但是......仍然不在弹出列表中......跨度>
    猜你喜欢
    • 1970-01-01
    • 2012-08-12
    • 2023-03-12
    • 1970-01-01
    • 1970-01-01
    • 2013-02-10
    • 2022-11-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多