A fix for AudioSessionInitialize Deprecated?

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

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

5条回答
  •  我在风中等你
    2021-02-05 08:23

    In swift we can add the following

    let audioSession = AVAudioSession.sharedInstance()
            do {
                try audioSession.setActive(true)
                try audioSession.setCategory(AVAudioSessionCategoryPlayback)
            } catch {
                print("Setting category to AVAudioSessionCategoryPlayback failed.")
            }
    

    from: https://developer.apple.com/documentation/avfoundation/avaudiosession

提交回复
热议问题