如何将音乐从我的应用程序切换到iPod [英] How To Switch music from my app to the ipod

查看:90
本文介绍了如何将音乐从我的应用程序切换到iPod的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的应用程序中使用MusicPlayerController对象播放音乐. 我知道在iphone ipod应用程序终止时可以继续播放我的应用程序音乐.

i am using MusicPlayerController object in my app to play music. i know that its possible to keep playing my app music when it's terminate on the iphone ipod app.

我该怎么办?

推荐答案

涉及到一些事情.

您必须在两个音乐播放器(应用程序音乐播放器和iPod音乐播放器)之间进行选择:

You have to choose between two music players, the application music player and the iPod music player:

+ (MPMusicPlayerController *)applicationMusicPlayer;
+ (MPMusicPlayerController *)iPodMusicPlayer;

如果选择iPodMusicPlayer,音乐将继续在后台播放,并且用户可以使用iPod(或音乐)应用程序将其停止.

If you choose the iPodMusicPlayer, music will continue to play in the background and the user can stop it using the iPod (or Music) app.

如果选择applicationMusicPlayer,默认情况下,当您将音乐发送到后台时,音乐将停止.如果要继续播放,则必须在Info.plist文件中设置UIBackgroundMode来告诉系统您应该继续运行.

If you choose the applicationMusicPlayer, by default the music will stop when you get sent to the background. If you want to continue playing, you'll have to set UIBackgroundMode in your Info.plist file to tell the system you should continue to run.

请参阅:应用程序状态和多任务处理 Info.plist键

这篇关于如何将音乐从我的应用程序切换到iPod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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