您的位置:首页 > 移动开发 > IOS开发

解决iOS程序耳机有声音,外放没声音的问题

2016-07-31 22:49 155 查看
在AppDelegeate中添加如下代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
AppDelegate.instance = self

let session = AVAudioSession.sharedInstance()
do{
try session.setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.MixWithOthers)
} catch let err as NSError {
NSLog(err.description)
}

return true
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: