0

My requirement is like enabling TTS(Text To Speech) for UILocalNotification alert body in background. So that the system will read the alert body at the same time it shows its corresponding notification.

Thanks much in advance.

GJDK
  • 723
  • 2
  • 7
  • 19

1 Answers1

0

When your local notification comes into your foregrounded app, you can do something like:

AVSpeechUtterance *utterance = [AVSpeechUtterance 
                                speechUtteranceWithString:@"Replace this sentence with contents of local notification"];
AVSpeechSynthesizer *synth = [[AVSpeechSynthesizer alloc] init];

[synth speakUtterance:utterance];

I'm not certain the synthesizer can be used while the app is in the background and out of sight of the user.

And more detail about this can be found in this related question.

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Thanks MIc. I have already implemented the suggestion of yours. But it didn't help me great, since the TTS did not work at times. That's why I posted this question to know whether there is any other alternative implementation for this scenario. – GJDK Jul 09 '15 at 11:00