Setting a voice for AVSpeechSynthesizer leads to an heap buffer overflow. Turn on address sanitizer in Xcode 14 beta and run the following code. Anybody else experiencing this problem, is there any workaround?
let synthesizer = AVSpeechSynthesizer()
var synthVoice : AVSpeechSynthesisVoice?
func speak() {
let voices = AVSpeechSynthesisVoice.speechVoices()
for voice in voices {
if voice.name == "Daniel" { // select e.g. Daniel voice
synthVoice = voice
}
}
let utterance = AVSpeechUtterance(string: "Test 1 2 3")
if let synthVoice = synthVoice {
utterance.voice = synthVoice
}
synthesizer.speak(utterance) // AddressSanitizer: heap-buffer-overflow
}