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: Steven Degutis <email@hidden>
- Date: Fri, 12 Feb 2010 21:29:26 -0500
Aaron's book came out before Snow Leopard, back when @optional was not
available; thus any protocol which declared at least 1 optional method must
be an informal protocol. This is not so anymore ever since 10.6's SDK. Thus,
NSSpeechSynthesizerDelegate did not exist when the book was written.
Steven Degutis
Software Engineer
Big Nerd Ranch, Inc.
http://www.bignerdranch.com/
On Fri, Feb 12, 2010 at 9:22 PM, Martin Beroiz <email@hidden>wrote:
>
> 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
>
--
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
_______________________________________________
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