After recently installing iOS 16 beta 5, we are experiencing an issue with try AVAudioSession.sharedInstance().setCategory(<category>, options: .mixWithOthers)
, in which we get an error, and lose the connection.
Here is the error:
AVAudioSession_iOS.mm:2365 Failed to set category, error: 'what'
There is no additional information about this error. Any help would be greatly appreciated.
FYI: This only began to occur specifically in iOS Beta 5, and was previously working in iOS Beta 4.
We've just hit this on iOS 16.1 (20B82). We were initially setting the category to .playback, then changed it to .playAndRecord when we needed to do recording. It was when we tried to change it back to .playback that we got the error.
I found that
audioSession.setActive(false)
before switching category, followed byaudioSession.setActive(true)
fixed the error.