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.).
我正在尝试实现注册流程,允许我的iOS应用程序出现在其他应用程序的“Open in”列表中(如苹果文档交互编程主题中所述)。我希望我的应用程序能够处理任何应用程序的音频文件格式(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. This is what I put in (via Xcode 4's Document Types editor):
按照我的理解,我所需要做的就是将CFBundleDocumentTypes类型键和相关的子数据添加到我的应用的Info.plist中。这是我输入的(通过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). Is there something obvious I'm doing wrong, or is there something else I need to implement?
添加这段代码后,我的应用程序不会显示在应用程序“打开”菜单中(我正在iPhone上测试,用Dropbox中的MP3作为文件源)。AudioMemos和Evernote都是Dropbox上的MP3文件,所以我知道这种格式是支持的)。有什么明显的地方我做错了,或者有什么东西我需要实现?
(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.)
(注意:我还没有在我的信息中设置utexportedtypedeclaration项目。plist,根据我的理解,只有定制的UTIs才需要这些。当我使用系统UTIs时,我认为它不应该是必要的,但是如果我错了请纠正我。
EDIT
编辑
I've added the following Exported Type UTI, with no success:
我添加了以下导出的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>
3 个解决方案
#1
55
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>
#2
5
You should use Alternate
instead of Alternative
你应该用替代的替代方法。
<key>LSHandlerRank</key>
<string>Alternate</string>
#3
0
<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>
#1
55
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>
#2
5
You should use Alternate
instead of Alternative
你应该用替代的替代方法。
<key>LSHandlerRank</key>
<string>Alternate</string>
#3
0
<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>