I'm not sure its going to work - but kind of need to test this.
So where ever you call AVSpeechSynthesisVoice.speechVoices(). Wrap it in a call to AVSpeechSynthesizer.requestPersonalVoiceAuthorization()
requestPersonalVoiceAuthorization will cause the pop up asking for access to appear. If they have already approved it passes straight through. When you call to speechVoices inside the request it will return the personal voice in the list of all the other voices.
The code will look something like:
AVSpeechSynthesizer.requestPersonalVoiceAuthorization() { status in
let voices = AVSpeechSynthesisVoice.speechVoices()
}
It does give you access to status which tells you if they approved or not but you dont actually need to use it really.
I'm not sure its going to work - but kind of need to test this.
So where ever you call AVSpeechSynthesisVoice.speechVoices(). Wrap it in a call to AVSpeechSynthesizer.requestPersonalVoiceAuthorization()
requestPersonalVoiceAuthorization will cause the pop up asking for access to appear. If they have already approved it passes straight through. When you call to speechVoices inside the request it will return the personal voice in the list of all the other voices.
The code will look something like:
It does give you access to status which tells you if they approved or not but you dont actually need to use it really.
Here is where it is in textaloud: https://github.com/AceCentre/TextAloud/blob/57d91b494f219a073cc8ce177135ab5178bf6f47/TextAloud/Services/Speech/Voice/AVSpeechVoiceService.swift#L23
Here is the docs: https://developer.apple.com/documentation/avfaudio/avspeechsynthesizer/4134517-requestpersonalvoiceauthorizatio?changes=lat_1_5_5