Apple Watch app AVSpeechSynthesizer not working in background

476 Views Asked by At

In my watchkit extension capability section there is no option to check the checkbox for audio in background mode section. I have also checked apple doc .

They are only 3 exception.

1) NSURLSession 2) WKAudioFilePlayer or WKAudioFileQueuePlayer 3) HKWorkoutSession

But i need my dynamic text to speak by the system. I am using this code

let dictSetting = UserDefaults.standard.value(forKey: "settings") as! [String : String]
let settingObj = SettingWatch(fromDict: dictSetting)
let utterance = AVSpeechUtterance(string: text)
utterance.voice = AVSpeechSynthesisVoice(language: "en-US")
self.synth = AVSpeechSynthesizer()
self.synth?.delegate = self
self.synth?.speak(utterance)

Is there any way that i can my Apple Watch app can speak the text even if in backgound. Or is there any way to keep my app in foreground? Please suggest if you have came across any solution.

0

There are 0 best solutions below