I am having problems using AVSpeechSynthesis on iOS 8.0.2 and XCode 5. I tried it on the simulator and got a "Speech initialization error: 2147483665". I then tried it on my iPhone 5 and got no error but no speech.
In my .h file I import
import
and have @property (strong, nonatomic) AVSpeechSynthesizer *synthesizer;
In my .m file I synthesis the synthesizer
I have AVFoundation referenced in my frameworks
On my viewDidLoad I do the following
self.synthesizer = [[AVSpeechSynthesizer alloc] init]; self.synthesizer.delegate = self;
Later on in my code to control what is said I do the following
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:dialog];
utterance.rate = AVSpeechUtteranceDefaultSpeechRate;
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-au"];
[self.synthesizer speakUtterance:utterance];
I have CCViewController : UIViewController in my view controller.
Does anyone know what is wrong? Does AVFoundation work in iOS 8?
I saw a similar post on stack overflow which said to initialize my speaking @" " but that did not work.
Any help would be appreciated.
Thanks, Greg