RE: warning when setting the delegate of SpeechSynthesizer
RE: warning when setting the delegate of SpeechSynthesizer
- Subject: RE: warning when setting the delegate of SpeechSynthesizer
- From: Martin Beroiz <email@hidden>
- Date: Fri, 12 Feb 2010 20:22:35 -0600
OMG, I'm sorry I just found that I should add <NSSpeechSynthesizerDelegate> next to the class definition.
Disregard my last message.
(I wonder why he doesn't mention that in the book).
Begin forwarded message:
> From: Martin Beroiz <email@hidden>
> Date: February 12, 2010 8:19:04 PM CST
> To: Cocoa Dev <email@hidden>
> Subject: warning when setting the delegate of SpeechSynthesizer
>
> Hello everybody,
>
> I'm having a difficult time trying to figure out why cocoa gives me a warning when trying to implement a delegate method in my class.
> I'm writing the SpeakLine application from Aaron Hillegass' book in which the user enters a line of text and there's 2 buttons: "Stop" and "Speak".
> When the user presses Speak, the speak button should go not enabled and Stop go enable, and when the SpeechSynthesizer finishes the opposite should happen.
>
> Anyway, I set the delegate as self in the init method, like so:
>
> -(id) init {
> [super init];
> speechSynth = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
> [speechSynth setDelegate:self];
> return self;
> }
>
> and implement the method didFinishSpeaking like this:
>
> -(void) speechSynthesizer:(NSSpeechSynthesizer *)sender didFinishSpeaking:(BOOL)complete {
> NSLog(@"Complete = %d", complete);
> [startButton setEnabled:YES];
> [stopButton setEnabled:NO];
>
> }
>
> I get the warning: "Class 'AppController' does not implement the 'SpeechSynthesizerDelegate' protocol" at the line [speechSynth setDelegate:self];
>
> Is there anything obviously wrong with what I'm doing? I followed the book exactly and still get this warning.
>
>
> Thanks in advance.
> Martin.
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden