简体   繁体   English

音频在模拟器(iOS 7.1)的背景上停止播放

[英]Audio stops on background on simulator (iOS 7.1)

Audio stops when you close app. 当您关闭应用程序时,音频会停止。 And may start again if you just open Control Center (swipe from bottom). 如果您只是打开控制中心(从底部滑动),则可能会再次开始。 It's really strange. 真的很奇怪

Everything's fine in iOS 8 simulator and devices. 在iOS 8模拟器和设备中一切正常。 The problem is I can't install iOS 7 on existing devices to test is it a bug in my app or it's a bug in simulator. 问题是我无法在现有设备上安装iOS 7进行测试是我的应用程序中的错误还是模拟器中的错误。

UIBackgroundModes in info.plist contains audio string object. info.plist中的UIBackgroundModes包含audio字符串对象。 Here is how I configure a session on app start: 这是我在应用启动时配置会话的方法:

- (void)setAudioSession {
    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
    [[AVAudioSession sharedInstance] setActive:true error:nil];
}

To play audio I use AVPlayer class. 要播放音频,我使用AVPlayer类。

这是iOS 7模拟器唯一的错误。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM