简体   繁体   English

用户按下主屏幕按钮时,如何使我的广播流应用程序继续唱歌?

[英]How can I make my Radio Streaming Application keep singing when the user press the home button?

I just finished my Radio station IOS application but I have 1 problem here .. when you are listening to the streaming and press the home button the application stop working .... I did some research and found some application keep the streaming after pressing the Home Button. 我刚刚完成了我的Radio Station IOS应用程序,但是这里有1个问题..当您在收听流媒体时,按下主屏幕按钮,该应用程序停止工作.....主页按钮。

is it an option in the Xcode I can enable it? 我可以启用Xcode中的选项吗?

You need to set the audio session category correctly: 您需要正确设置音频会话类别:

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];

check also this question: iPhone OS 4 Multitasking - Playing Audio In background 还要检查以下问题: iPhone OS 4多任务处理-在后台播放音频

我解决了这个问题,我只是在Plist中设置了一个条目

Required background modes : App plays audio

暂无
暂无

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

相关问题 当 iPhone 用户退出主屏幕或 App Switcher 时,如何让我的计时器继续运行? - How can I make my timer keep running when the iPhone user quits to the home screen or the App Switcher? 当我运行我的iPhone应用程序时,它只显示一个白色的窗口,但是当我按下主屏幕按钮时,它显示了输出问题。 - When i run my iPhone application it just show a white window, but when I press home button then it shows output what's wrong with it? 在 iOS 4.3 中,当您按下主页按钮或按下开/关按钮时,我如何区分背景模式? - in iOS 4.3, how i can differentiate between the background mode, when you press the home button or when you press the on/off button? 当我按下按钮时,我想在iPhone应用程序开发中创建一个标签栏控制器。 - When i press a button then i want to make a tabbar controller in iPhone application development.how? 按两次主页按钮时,在iphone中应用关闭通知 - Application close notification in iphone when press home button twice 在Springboard上按主页按钮和agin Tap应用程序图标时,如何重新启动同步过程? - How to restart sync process when press home button and agin tap application icon on Springboard? 如何让我的应用程序检测到按下的主页按钮? - How can I make my app detect the home button being pressed? 按下按钮时如何撤消UITextField? - How can I Undo UITextField when i press a button? 用户按下按钮时如何重置UI? - How can I reset my UI when the user presses a button? 什么功能可以帮助我了解用户在文本字段中输入的第一个字符,以及按键盘返回键时如何使空白行? - what function can help me to know user input first character in textfield and how to make a blank line when I press keyboard return?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM