I’m working with Xcode 4.4.1, so perhaps some of the inconsistencies here are due to template differences. Anyway, here goes:

When I made the text field to header file connection (pp. 92-93), set it to Outlet and named it textField, Xcode made the @property line, but it did not “automatically create an instance variable named _textField,” as the book said it would. I got “@synthesize textField;” not “@synthesize textField = _textField;” as shown in the book code (p. 95). I made the change manually. Also, “@synthesize window = _window;” was not generated automatically, but the book never showed it in bold (i.e., it didn’t instruct me to manually include it). In any case, the build ran fine without it. Why, I don’t know.

Also, my SpeakLineAppDelegate.m file contained the following method skeleton:

  • (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    // Insert code here to initialize your application

I ignored it, but it would be nice to know whether or how to use it.

Lastly, for those with good eyesight and attention to detail, in Figures 5.11 and 5.12, the attribute for the “window” outlet is “strong,” but in the text it is “assign.” I know we don’t get to an explanation of “assign” until page 125, but the inconsistency here (along with those above) makes one wonder…

I’m sure some of the above is readily comprehensible to experienced programmers. I, unfortunately, am new to programming (not counting self-taught MATLAB and Psychtoolbox) and only finished reading the BNR Objective-C Programming book last week, so I’m lost even when I don’t know it.

Insights regarding the above would be appreciated.



Indeed, many of the differences you are seeing are indeed due to changes in the Xcode templates. There have been a number of improvements to the compiler in recent years, particularly as far as making certain aspects of the language optional (such as @synthsize, or explicitly defining instance variables), and the Xcode templates have been gradually updated to reflect this. Unfortunately the book is something of a snapshot of a point in time.

The book is not explicit about it, but yes you can ignore -applicationDidFinishLaunching:. Usually we do application startup work in this method. We use -init instead here because in Chapter 6 we depend upon the _voices array being initialized. The table view will load its data prior to -applicationDidFinishLaunching: being called, so -init is the most appropriate place to initialize its data.

Finally, regarding strong vs assign for the NSWindow outlet, yes at the time the screenshots were made the templates were using strong; it is an oversight that they were not updated to match the text, which was updated.

I’ll update the errata to make these differences more clear. These sorts of changes can be confusing and frustrating, but it sounds like you are on top of these differences now. If you have any additional questions, please let us know.