- info.plist添加
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
-
BackgroundModes打开Audio
image.png -
代码添加
// 后台播放音频
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
[audioSession setActive:YES error:nil];
网友评论