I am using this for reference to add speechRecognizer to my app.
https://github.com/ahmaddorra/Scrumdinger/blob/main/Scrumdinger/Models/SpeechRecognizer.swift
Function
private static func prepareEngine() throws -> (AVAudioEngine, SFSpeechAudioBufferRecognitionRequest) {
contains
try audioSession.setActive(true, options: .notifyOthersOnDeactivation)
Apple documentation states:
“Only use this option when deactivating your audio session; that is, when you pass a value of false to the setActive(_:options:) instance method.”
I want to get clarity if this is some undocumented way of deactivating audioSession (I doubt that), or if in general, app that activates audioSession should always deactivate it at some point before or during becoming inactive, background or terminated.