Re: Two Compile Errors I can't seem to clear: Hillegass Book
Re: Two Compile Errors I can't seem to clear: Hillegass Book
- Subject: Re: Two Compile Errors I can't seem to clear: Hillegass Book
- From: Michael Babin <email@hidden>
- Date: Sun, 30 Oct 2011 11:35:07 -0500
On Oct 30, 2011, at 10:30 AM, Amanda Rains wrote:
> Running Xcode 3.2.6
> on Mac OSX 10.6.8 (Still on Snow Leopard)
> on MacBook
>
> In Chapter 6 of Hillegass's Book "Cocoa Programming for Mac OS X Third Edition
I don't have the third edition of the book, but I do have the second edition. From your description, this sounds very similar to Chapter 5 in the second edition (Helper Objects).
> Modifying the Speech Synthesis Program by adding the Table View of Voices.
>
> On Page 96
> adding this line to the init method
> [speechSynth setDelegate:self];
> The compile yields the following error message
> warning: class 'AppController' does not implement the 'NSSpeechSynthesizerDelegate' protocol
In the 10.6 SDK, many delegate protocols were changed from informal protocols to formal protocols with optional methods. You can read a bit more about the details and differences here: <http://developer.apple.com/library/ios/#DOCUMENTATION/General/Conceptual/DevPedia-CocoaCore/Protocol.html>
Essentially, what you need to do to eliminate this warning is change the definition of your AppController class from something like:
@interface AppController : NSObject
to:
@interface AppController : NSObject <NSSpeechSynthesizerDelegate>
so that when you call [speechSynth setDelegate:self] in the AppController, you're passing it an object as the delegate that you have declared as implementing/following the NSSpeechSynthesizerDelegate protocol.
> ALSO
> On Page 106
> the following line
> [tableView selectRow:defaultRow byExtendingSelection:NO];
> The compile yields the following message
> warning: 'selectRow:byExtendingSelection:' is deprecated (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableView.h:655)
This one is also easy to eliminate. In the documentation for -[NSTableView selectRow:byExtendingSelection:], they recommend using -[NSTableView selectRowIndexes:byExtendingSelection:] instead. You just have to pass in an NSIndexSet with your row index instead as the first argument:
[tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:defaultRow] byExtendingSelection:NO];
> Since these are warnings the program compiles and runs.
> The defaultVoice 'Alex' is selected in the Voice Table.
> The text in the textField is spoken correctly
> I can select a new voice like 'agnes'
> But the voice does not change.
>
> I assume the warnings need to be dealt with to be able to change the voice.
Neither of these warnings would likely cause the problem you are seeing, so I doubt eliminating them will eliminate the problem (voice does not change).
A more likely cause is that you haven't implemented (at all or correctly) the delegate method for your table view in AppController:
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
Or you failed to connect the delegate outlet of your table view in Interface Builder to your AppController object. If the delegate method is implemented, you can set a breakpoint inside the method or add NSLog statements to determine if it is being called when the selection in your table changes.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden