Errata for the 4th Edition


Here is the errata for the 4th edition; I will be updating this thread with any subsequent bugs. Please post any problems you encounter in the book in the forum for that chapter and I will collect them here. Thanks!

General Note:

XIB files in recent versions of Xcode (Lion and newer) default to having Autolayout enabled. The 4th edition was written when Autolayout was “opt-in”, so you may want to disable Autolayout in your projects, particularly those in Chapter 17 where we work with the Size Inspector. You can disable Autolayout in the File Inspector on each XIB file.

Chapter 2:
p. 21: Figure 2.14 - The -init and -dealloc methods shown in this screenshot will not be created with the current Xcode templates, and should be disregarded.

Chapter 4:
p. 82: The paragraph before “ARC Odds and Ends” should read:

Chapter 5:
p. 83: ‘Foo’ should be ‘RandomController’.
p. 95: The template-generated SpeakLineAppDelegate.m will have a method in it, -applicationDidFinishLaunching:. You may safely ignore it or delete it when making these changes.
The Xcode templates have changed since this chapter was written. For example, matching instance variables are no longer explicitly created when creating an outlet, and the @synthesize line does not explicitly name the instance variable. To make it easier to follow the book we recommend fixing the template generated code to match the book.
The figures in this chapter show the ‘strong’ attribute in the @property lines instead of ‘assign’ (NSWindow) or ‘weak’ (for NSTextField); please use the text as a guide for what the @property attributes should be. The figures were made with slightly older Xcode templates and should be used to guide you in dragging to make connections.

Chapter 6:
p. 100: The page references “SpeechLineAppDelegate” in two places, both of which should read “SpeakLineAppDelegate”.
p. 108, Remove opening parenthesis on sentence beginning: “This may be a bit”.
p. 109: Figure 6.10 caption says “NS tableView” – should read "NSTableView"
p. 111: Occurrences of _startButton in code blocks should be _speakButton.
p. 114: Sentence referencing “AppController” should read: "You might want to try adding this method to SpeakLineAppDelegate.m now."
p. 115: Figure 6.11 shows an outlet named “newItemField”, but ARC forbids properties with “new” in the name. Consider using “itemField” instead.

Chapter 8:
p. 143: “Attributes Inspector” should be “Identity Inspector”

Chapter 9:
p. 152: “insert:” should be “add:”.

General note: be sure to check the note on page 155: adding Undo to your application will make autosave kick in, which will cause an exception (or an error message). You can ignore the error, or disable autosave by changing -autosavesInPlace to return NO.

Chapter 10:
p. 165: “NSError *e;” should be “NSError *error;”

Chapter 11:
p. 181: “Cocoa -> Data Views” should be “Cocoa -> Controls”.
p. 191: “createNewEmployee:” should be “createEmployee:”.

Chapter 13:
p. 208: Under Mac OS X 10.7 and forward, due to state restoration a new document will not be opened every time you run the application. Instead, Cocoa will open whatever documents were open last time the application ran.
p. 210: In figure 13.3: “lunch time” should be “launch time”.

Chapter 16:
p. 234, figures 16.2, 16.6: Recent versions of Xcode have changed the localization interface. To add a new localization language, select the project in the Project Navigator, select the project (not the target), and use the + button there to add a new language. You will then be prompted to choose to create localized versions of selected resources within the project.
p. 239: “–generate-stringsfile” should be “–export-strings-file” ("–generate-strings-file" works as well).

Chapter 17:
See above note on disabling Autolayout.

Chapter 21:
p. 297: Method prototype listing for -setDataProvider:forTypes: leaves out the closing angle bracket on the first parameter. It should read: “id”.

Chapter 25:
p. 336: Second line of top code snippet: the variable voidNumber is defined; this variable should be named voidPhone.

Chapter 26:
p. 347: Format string should be @"%@ is not a color" – %@ is missing.

Chapter 27:
p. 357: When setting raiseString, multiply [p expectedRaise] * 100.0 to get proper % output.
p. 357: Quotes are missing around PeopleView.h on the line: #import “PeopleView.h”

Chapter 30:
p. 385: Figure 30.3 should show that Automatic Reference Counting is enabled for this exercise’s project settings.

Chapter 32:
p. 411: To get rid of the warning in removeEmployeesObject:, cast the return value of [self manager] to (Employee *).