解决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
}
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
}
相关文章推荐
- 小程序ios音频播放没声音问题的解决
- ubuntu下音箱有声音,耳机没声音之类问题解决办法
- ubuntu 11.04解决插入耳机状态下耳机没声音喇叭有声音的问题
- win7耳机和音箱没声音怎么解决如何快速找出问题所在
- IOS中录音后再播放声音太小问题解决
- 解决Ubuntu下耳机没有声音的问题
- 解决iOS程序UI主线程和定时器相互阻塞的问题
- 解决Ubutnu下关于Firefox中播放FLV时其他程序不能播放声音的问题
- 解决iOS程序UI主线程和定时器相互阻塞的问题
- 解决装了Ubuntu耳机没有声音的问题(外放有声音)
- 解决极光推送IOS接收到推送消息后无声音及震动问题
- IOS开发问题解决之Xcode运行程序时attaching to挂起不动
- 解决iOS程序UI主线程和定时器相互阻塞的问题
- ios-通知:闹钟之关于设置闹钟后,点击app图标进入程序不播放音乐的问题(已解决)
- 解决Ubuntu 9.04 耳机有声音但外放无声问题
- 插入耳机时播放音乐,铃声和闹钟,音乐没有声音的问题解决
- IOS学习之路二十(程序json转换数据的中文字符问题解决)
- IOS学习之路二十(程序json转换数据的中文字符问题解决)
- 【其他】解决ubuntu与win7双系统耳机没有声音的问题
- IOS中录音后再播放声音太小问题解决