标签:
步骤1:
info.plist文件中添加:Required background modes字段,里面的item 值选择:App plays audio or streams audio/video using AirPlay
步骤二:
在Appdelegate.m中:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//后台播放音乐 步骤二:
{
AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *setCategoryError = nil;
[session setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError];
NSError *activationError = nil;
[session setActive:YES error:&activationError];
}
}
标签:
原文地址:http://www.cnblogs.com/niit-soft-518/p/4593154.html