注册应用程序以打开图像文件

时间:2012-02-28 12:02:02

标签: iphone ios cocoa-touch ipad

我已成功注册我的应用以打开PDF文件,方法是在我的info.plist中包含以下内容:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>PDF</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.adobe.pdf</string>
        </array>
    </dict>
</array>

但是,我似乎无法注册我的应用程序来打开任何图像文件,我试图不仅注册基本图像UTI,还注册特定类型,如png和jpg。是否可以注册打开图像文件?

3 个答案:

答案 0 :(得分:2)

坏消息 - 无法完成。希望这些内容能在文档中说明。

答案 1 :(得分:1)

打开包含源代码的plist并将其添加到文档中。

<dict>
            <key>CFBundleTypeName</key>
            <string>All Files</string>
            <key>CFBundleTypeIconFiles</key>
            <array/>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.data</string>
                <string>public.content</string>
            </array>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>LSHandlerRank</key>
            <string>Owner</string>
        </dict>

我希望这对你有用。

答案 2 :(得分:-1)

用编辑器打开plist ......

大写等是至关重要的,建议同时指定小写和大写文件扩展名。

<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>jpg</string>
<string>JPG</string>
</array>
<key>CFBundleTypeName</key>
<string>Images</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>

然后保存文件。现在应该注册应用程序来处理这种类型的文件。

相关问题