A fix for AudioSessionInitialize Deprecated?

前端 未结 5 1075
半阙折子戏
半阙折子戏 2021-02-05 07:31

Apple did not post any alternative code for this on the Apple Developer site.

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-05 08:06

    Swift version:

    do {
        try AVAudioSession.sharedInstance().setActive(true)
    } catch let error {
        print("\(error.localizedDescription)")
    }
    
    do {
        try AVAudioSession.sharedInstance().setCategory(.playback, mode: .spokenAudio)
    } catch let error {
        print("\(error.localizedDescription)")
    }
    

提交回复
热议问题