【问题标题】:IOS: Run application audio and phone music audio together in backgroundIOS:后台同时运行应用程序音频和手机音乐音频
【发布时间】:2013-09-04 08:15:16
【问题描述】:

我需要我的应用程序音频继续运行,即使它与设备音乐音频一起进入后台。我尝试了page 中的代码建议,但我的应用程序仍然无法运行。

  1. 将必需的后台模式设置为应用播放音频
  2. 将应用程序不在后台运行设置为是

AppDelegate.m

NSError *setCategoryErr = nil;
NSError *activationErr  = nil;
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error:&setCategoryErr];
[[AVAudioSession sharedInstance] setActive:YES error:&activationErr];

【问题讨论】:

  • 你在info.plist中设置了具体的权限吗?
  • 我已经设置好了。

标签: iphone ios audio avaudiosession


【解决方案1】:

在这里你可以找到一个相关的问题。

How to handle background audio playing while iOS device is locked or on another application?

我建议你看看这个教程:

http://mobile.tutsplus.com/tutorials/iphone/ios-sdk_background-audio/

它解释了所有要遵循的不同步骤。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-13
    相关资源
    最近更新 更多