阅读背景:

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

来源:互联网 

在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



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: