• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Two Compile Errors I can't seem to clear: Hillegass Book (FIXED)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Two Compile Errors I can't seem to clear: Hillegass Book (FIXED)


  • Subject: Two Compile Errors I can't seem to clear: Hillegass Book (FIXED)
  • From: Amanda Rains <email@hidden>
  • Date: Sun, 30 Oct 2011 19:21:18 -0700

Oops forgot to send this fixed message to list.


Michael

OK!  Thanks - You are correct on all accounts.

By following your advice below I eliminated the warnings. 

AND of course the problem still persisted. 

I First checked the connections in the Interface Builder and they seemed ok at first glance.

I put a breakpoint on the first line of code and after changing voices from 'Alex' to 'Agnes' the breakpoint was not reached 

SO...  I went back and the read the book very carefully and it states "Besides having a dataSource outlet, a table view has a delegate outlet"
When I followed the book in connecting up the various elements to the AppController it didn't tell me about connecting the TableView delegate to the AppController. 
AND so with your comments below I decided to go ahead and make the connection AND of course the program works correctly. 

No compile errors or warnings.
I can switch voices.

SO ITS FIXED - Thanks

Amanda

On Oct 30, 2011, at 9:35 AM, Michael Babin wrote:

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.



Amanda Rains
email@hidden

This message was generated on my Mac.





 _______________________________________________
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

  • Prev by Date: Re: Debugging a static library
  • Next by Date: CoreBluetooth framework
  • Previous by thread: Re: Debugging a static library
  • Next by thread: CoreBluetooth framework
  • Index(es):
    • Date
    • Thread