is there a way to programmatically download a AVSpeechSynthesisVoice not available in the iphone?
I am able to alert the user they don't have the voice, but I get a silly alert that you need to go to settings blablabla but I want to download it programmatically right there, make it easy peasy for the user. is there a way to do this?
private func requestSpeechRecognizerAuthorization(completion: @escaping (SFSpeechRecognizerAuthorizationStatus) -> Void) {
let voice = AVSpeechSynthesisVoice(identifier: "com.apple.voice.enhanced.en-IN.Rishi")
guard voice != nil else {
DispatchQueue.main.async {
let alert = UIAlertController(title: "Voice not available", message: "The voice required for this app is not available. Please download it from Settings > Accessibility > Spoken Content > Voices and try again.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
UIApplication.shared.windows.first?.rootViewController?.present(alert, animated: true, completion: nil)
}
return
}
SFSpeechRecognizer.requestAuthorization { authStatus in
DispatchQueue.main.async {
completion(authStatus)
}
}
}