I am attempting to use the AVSpeechSynthesizer
to include text to speech in my Swift Playgrounds project, but when I attempt to use it on my IPhone i get the following errors:
It works just fine on the simulator, but no audio is produced when I run it on-device. Is there a way to set this "bundle display name" within Swift Playgrounds, or are there any workarounds?
My code:
import AVFoundation class Speaker { let synthesizer = AVSpeechSynthesizer() func speak() { let utterance = AVSpeechUtterance(string: "Test, I am the speaker") synthesizer.speak(utterance) } }