将音频和视频类型与iPhone应用程序相关联 [英] Associate Audio and Video Types with iPhone app

查看:88
本文介绍了将音频和视频类型与iPhone应用程序相关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个应用程序,通过使用长按>在我的应用程序中打开来接收来自Mail应用程序的媒体文件

I am trying to make an app that will receive media files from the Mail app by using Long Press > Open in "My app"

我无法关联我的应用程序所需的文件类型。我正在使用统一类型标识符参考

I am having trouble associating the files types I want with my app. I am using the Uniform Type Identifiers Reference

这是我的info.plist的样子:

This is what my info.plist looks like:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>mp3</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>MP3 Audio</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.mp3</string>
        </array>
        <key>LSTypeIsPackage</key>
        <false/>
    </dict>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>avi</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>AVI movie</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.avi</string>
            <string>video/x-msvideo</string>
        </array>
        <key>LSTypeIsPackage</key>
        <false/>
    </dict>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>3gp</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>3GPP movie</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.3gpp</string>
            <string>application/octet-stream</string>
        </array>
        <key>LSTypeIsPackage</key>
        <false/>
    </dict>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>mpg4</string>
            <string>mp4</string>
            <string>m4v</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>MPEG-4 content</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.mpeg-4</string>
            <string>video/mp4</string>
            <string>video/mp4v</string>
        </array>
        <key>LSTypeIsPackage</key>
        <false/>
    </dict>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>mov</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>QuickTime movie</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.apple.quicktime-movie</string>
            <string>video/quicktime</string>
        </array>
        <key>LSTypeIsPackage</key>
        <false/>
    </dict>
</array>

其中,只有Mp3和AVI显示Open InMy app选项。我刚刚收到保存视频选项,将视频添加到我的相机胶卷。我究竟做错了什么?

Out of these, only Mp3 and AVI show the Open In "My app" option. I just get the "Save Video" option that adds the videos to my camera roll. What am I doing wrong?

我想要关联的格式是:AVI,3GP,MP4,M4V,MOV。

The formats I want to associate are: AVI, 3GP, MP4, M4V, MOV.

我有也尝试了这个。它适用于MP3,WAV,AVI,FLV,但仍然没有适用于3GP,MP4,MOV,M4V

I have also tried this. It works for MP3, WAV, AVI, FLV but still no go for 3GP, MP4, MOV, M4V

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Audio</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.audio</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Video</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.movie</string>
        </array>
    </dict>
</array>


推荐答案

我安装了其他应用程序(例如TeamViewer,oPlayer等) )它也支持文档导入..它们也不会出现在MOV,3GP,M4V等邮件应用程序的打开为...操作表中。

I have installed other apps (e.g TeamViewer, oPlayer etc) that also support Document importing.. They too dont show up in the "Open As .." Action Sheet for the Mail app for MOV, 3GP, M4V etc.

我猜测苹果不允许第三方应用程序打开某些文件,并希望它们在内部处理。所以用户可以做的就是将它们保存到相机胶卷。

I am guessing that apple doesnt allow some files to be opened by 3rd party apps and wants them handled internally. So all the user can do is save them to the Camera Roll.

剩下的唯一选择是为我们的应用添加功能,以便从相机胶卷中选择视频。所以,邮件>保存视频>相机胶卷>第三方应用

The only options that remains is to add functionality to our apps to allow selecting videos from the camera roll. So, Mail > Save Video > Camera Roll > 3rd Party App

真可惜。

我的最终参赛作品在Info.plist中

My Final entries in Info.plist

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Audio</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.audio</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Video</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.3gpp</string>
            <string>public.3gpp2</string>
            <string>public.mpeg-4</string>
            <string>public.avi</string>
            <string>com.apple.quicktime-movie</string>
            <string>public.mpeg</string>
            <string>public.movie</string>
        </array>
    </dict>
</array>

我仍然希望有一些解决这个问题的方法......任何人?

I am still hoping there is some way around this.. anyone?

这篇关于将音频和视频类型与iPhone应用程序相关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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