简体   繁体   English

为什么我的iOS应用程序没有出现在其他应用程序的“打开方式”对话框中?

[英]Why is my iOS app not showing up in other apps' “Open in” dialog?

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

As I understand it, all I should need to do is add the CFBundleDocumentTypes key, with relevant subdata, to my app's Info.plist. 据我了解,我需要做的就是将CFBundleDocumentTypes键和相关的子数据添加到我的应用程序的Info.plist中。 This is what I put in (via Xcode 4's Document Types editor): 这是我放入的(通过Xcode 4的文档类型编辑器):

<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>

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). 添加此代码不会在应用程序的“打开方式”菜单中显示我的应用程序(我在iPhone上测试,使用Dropbox中的MP3作为文件源。应用程序AudioMemos和Evernote都显示为Dropbox中的MP3文件,所以我知道支持的格式)。 Is there something obvious I'm doing wrong, or is there something else I need to implement? 有什么明显的东西我做错了,还是还有其他我需要实现的东西?

(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.) (注意:我没有在我的Info.plist中设置UTExportedTypeDeclarations项目,因为我理解这些只是自定义UTI所必需的。因为我使用的是系统UTI,我认为它不是必需的,但请纠正我,如果我错了。)

EDIT 编辑

I've added the following Exported Type UTI, with no success: 我添加了以下Exported Type UTI,但没有成功:

<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>

You should use Alternate instead of Alternative 您应该使用Alternate而不是Alternative

<key>LSHandlerRank</key>
<string>Alternate</string>
<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>"*"</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>Unknown</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.data</string>
        </array>
    </dict>
</array>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么“打开方式...”对话框中没有建议我的 iOS 应用程序? - Why is my iOS app not suggested in the “Open in…” dialog? 如何从我的应用程序打开我的设备上的其他应用程序 - How to open other apps on my device from my app 注册应用程序以从Safari的“共享”或“打开...”对话框中打开不起作用。 (虽然从其他应用程序工作) - Register app to open from Safari's “share” or “open in…” dialog not working. (though works from other apps) Swift 5 IOS facebook 共享对话框,未显示在我的应用程序上 - Swift 5 IOS facebook share dialog, is not showing on my app iOS 8从其他应用程序在我的应用程序中打开图像 - IOS 8 open image in my app from another apps 我的 IOS 应用程序用于监控其他已安装应用程序的使用情况 - My IOS app to monitor usage of other installed apps 其他应用会影响我的应用在iOS上的表现吗? - Do other apps affect my app's performance on iOS? 如何使我的辅助功能应用程序覆盖iOS上的其他应用程序? - How to have my accessibility app overlay other apps on iOS? FBSDKLoginManager 未在本机 ios 应用程序中打开登录对话框 - FBSDKLoginManager not open login Dialog in native ios apps 启动屏幕图像未显示在设备上的ios应用程序上 - The launch screen image not showing up on my ios app on the device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM