为什么我的iOS应用程序没有显示在其他应用程序中“打开”对话? [英] Why is my iOS app not showing up in other apps' "Open in" dialog?

查看:1369
本文介绍了为什么我的iOS应用程序没有显示在其他应用程序中“打开”对话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实施注册过程,该过程允许我的iOS应用程序显示在其他应用程序的打开方式列表中(如 Apple的文档交互编程主题)。我希望我的应用程序能够处理来自任何提供标准音频文件格式(MP3,AIFF,WAV等)的应用程序的音频。

I am trying to implement the registering process that allows my iOS app to show up in the "Open in" list of other applications (as described in Apple's Document Interaction Programming Topics). I want my app to be able to handle audio from any app that will provide a standard audio file format (MP3, AIFF, WAV, etc.).

据我了解它,我需要做的就是将 CFBundleDocumentTypes 键和相关的子数据添加到我的应用程序的Info.plist中。这是我放入的(通过Xcode 4的文档类型编辑器):

As I understand it, all I should need to do is add the CFBundleDocumentTypes key, with relevant subdata, to my app's Info.plist. This is what I put in (via Xcode 4's Document Types editor):

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array>
            <string>scrubbulator-icon</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>Audio</string>
        <key>LSHandlerRank</key>
        <string>Alternative</string>
        <key>LSItemContentTypes</key>
        <array>
        <string>public.mp3</string>
        </array>
    </dict>
</array>

添加此代码并未在应用程序的打开方式菜单中显示我的应用程序(我是在iPhone上测试,使用Dropbox中的MP3作为文件源。应用程序AudioMemos和Evernote都显示为Dropbox中的MP3文件,所以我知道格式是支持的)。有什么明显的东西我做错了,还是还有其他我需要实现的东西?

The addition of this code is not displaying my app in apps' "Open in" menu (I am testing on an iPhone, using an MP3 in Dropbox as the file source. The apps AudioMemos and Evernote are both displayed for an MP3 file in Dropbox, so I know the format is supported). Is there something obvious I'm doing wrong, or is there something else I need to implement?

(注意:我还没有设置我的Info.plist中的UTExportedTypeDeclarations 项目,因为我理解这些仅适用于自定义UTI。由于我使用的是系统UTI,我认为它不应该是必要的,但如果我是的话请纠正我错误。)

(Note: I have not set up a UTExportedTypeDeclarations item in my Info.plist, as I understand these to be necessary only for custom UTIs. As I'm using System UTIs I believe it shouldn't be necessary, but please correct me if I am wrong.)

编辑

我添加了以下导出类型UTI,但没有成功:

I've added the following Exported Type UTI, with no success:

<key>UTExportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeConformsTo</key>
        <array>
        <string>kUTTypeMP3</string>
        </array>
        <key>UTTypeDescription</key>
        <string>Audio file</string>
        <key>UTTypeIdentifier</key>
        <string>kUTTypeMP3</string>
        <key>UTTypeTagSpecification</key>
        <dict>
        <key>public.filename-extension</key>
        <array>
            <string>mp3</string>
        </array>
        </dict>
    </dict>
</array>


推荐答案

对于所有标准文件格式:

For all standard file format:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Unknown File</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.calendar-event</string>
            <string>public.database</string>
            <string>public.executable</string>
            <string>public.data</string>
            <string>public.content </string>
            <string>public.item</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Video</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.video</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.image</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Web Archive</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.apple.webarchive</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>iWork Keynote</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.apple.keynote.key</string>
            <string>com.apple.iwork.keynote.key</string>
            <string>com.apple.iwork.keynote.kth</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>iWork Numbers</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.apple.numbers.numbers</string>
            <string>com.apple.iwork.numbers.numbers</string>
            <string>com.apple.iwork.numbers.template</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>iWork Pages</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.apple.page.pages</string>
            <string>com.apple.iwork.pages.pages</string>
            <string>com.apple.iwork.pages.template</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>OpenDocument Spreadsheet</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>org.oasis.opendocument.spreadsheet</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>OpenDocument Presentation</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>org.oasis.opendocument.presentation</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>OpenDocument Text</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>org.oasis.opendocument.text</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Folder</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.folder</string>
        </array>
    </dict>







    <dict>
        <key>CFBundleTypeName</key>
        <string>Audio</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.audio</string>
            <string>public.mp3</string>
            <string>public.mpeg-4-audio</string>
            <string>com.apple.protected-​mpeg-4-audio</string>
            <string>public.aifc-audio</string>
            <string>com.apple.coreaudio-​format</string>
            <string>public.aiff-audio</string>
        </array>
    </dict>







    <dict>
        <key>CFBundleTypeName</key>
        <string>Movie</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.movie</string>
            <string>public.3gpp2</string>
            <string>public.3gpp</string>
            <string>public.mpeg</string>
            <string>com.apple.quicktime-movie</string>
            <string>public.mpeg-4</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>GIF image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.compuserve.gif</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>PNG image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.png</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>TIFF image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.tiff</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>JPEG image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.jpeg</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>XML</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.xml</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>HTML</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.html</string>
            <string>public.xhtml</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Rich Text</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.rtf</string>
            <string>com.apple.rtfd</string>
            <string>com.apple.flat-rtfd</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Text</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.text</string>
            <string>public.plain-text</string>
            <string>public.utf8-plain-text</string>
            <string>public.utf16-external-plain-​text</string>
            <string>public.utf16-plain-text</string>
            <string>com.apple.traditional-mac-​plain-text</string>
            <string>public.source-code</string>
            <string>public.c-source</string>
            <string>public.objective-c-source</string>
            <string>public.c-plus-plus-source</string>
            <string>public.objective-c-plus-​plus-source</string>
            <string>public.c-header</string>
            <string>public.c-plus-plus-header</string>
            <string>com.sun.java-source</string>
            <string>public.script</string>
            <string>public.shell-script</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>zip</string>
            <string>zipx</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>Zip archive</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.zip-archive</string>
            <string>public.archive</string>
            <string>com.pkware.zip-archive</string>
            <string>com.pkware.zipx-archive</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>rar</string>
            <string>RAR</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>Rar archive</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.rarlab.rar-archive</string>
            <string>public.archive</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>7z</string>
            <string>7Z</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>7z archive</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>org.7-zip.7-zip-archive</string>
            <string>public.archive</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Waveform audio</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.microsoft.waveform-​audio</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Windows icon image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.microsoft.ico</string>
            <string>com.apple.icns</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Windows bitmap image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.microsoft.bmp</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Microsoft PowerPoint</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.microsoft.powerpoint.​ppt</string>
            <string>org.openxmlformats.presentationml.presentation</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Microsoft Excel</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>org.openxmlformats.spreadsheetml.sheet</string>
            <string>com.microsoft.excel.xls</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Microsoft Word</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.microsoft.word.doc</string>
            <string>com.microsoft.word.wordml</string>
            <string>org.openxmlformats.wordprocessingml.document</string>
        </array>
    </dict>
    <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>

这篇关于为什么我的iOS应用程序没有显示在其他应用程序中“打开”对话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆