IPCAUClient.cpp:139 IPCAUClient: can't connect to server (-66748) <0x104309130>

When using the AVSpeechSynthesizer() , I get an error after a couple of seconds :"IPCAUClient.cpp:139 IPCAUClient: can't connect to server (-66748) <0x104309130>", and then it speaks the text. The second time I call speak, there is no delay and error and it speaks immediately.

Where does this error and delay come from and how can I resolve it?

Intialization code:

        self.audioSession = AVAudioSession.sharedInstance() // 2) handle audio session first, before trying to read the text
        do {
            try audioSession.setCategory(.playback, mode: .voicePrompt, options: .duckOthers)
            try audioSession.setActive(false)
        } catch let error {
            Logger.model.debug("❓\(error.localizedDescription)")
        }
        
        speechSynthesizer = AVSpeechSynthesizer()
        speechSynthesizer.usesApplicationAudioSession = true

Speak code:

        let utterance = AVSpeechUtterance(string: text)
        utterance.preUtteranceDelay = 0.1
        utterance.rate = 0.5
        utterance.pitchMultiplier = 0.75
        utterance.prefersAssistiveTechnologySettings = false
        self.speechSynthesizer.speak(utterance)

The last statement gives this error message!

Having the same issue, using: iPhoneXR iOS 17.5.1 XCode Version 15.4 (15F31d)

IPCAUClient.cpp:139 IPCAUClient: can't connect to server (-66748) &lt;0x104309130&gt;
 
 
Q