4th Edition Errata


#1

As errata are discovered, they will be added to this post.


#2

The sentence before Figure 2.20 has the extraneous word “gets” that should be deleted.


#3

The icon provided with the Zip file icon@2x is 114x114 px it should be 120x120 px to prevent a runtime error.

Location 855 of 14953 (Kindle)

“Lets start by defining the two action methods: showQuestion: and showAnwer:”

Typo on showAnswer


#4

On page 72 (Chapter 3 "Strong and Weak References section) of the printed edition, the following line of code:

calculator.container = backpack;

should be added to main.m to set up the strong reference cycle error
discussed in the example.


#5

The two launch images mentioned in chapter 1, position 1134 in the Kindle edition, are not provided with the ZIP file.


#6

The conclusion to Chapter 2 introduces the ideas of modules, leading someone to want to try @import for the first time. However, the current defaults in XCode 5.0.2 have Enable Modules set to ‘No’ for MacOS projects, so this doesn’t compile and it’s not immediately obvious why not. iOS projects have it set automatically, so it’s not so surprising that this wasn’t obvious to the author.

The fix is to specifically have someone check that their Build Settings:Apple LLVM 5.0 - Language - Modules:Enable Modules (C and Objective-C) is set to Yes.


#7

Chapter 3, in the section on @property, page 76 and 77 in the physical book, there is a discrepancy in the ordering of the initializers and the property declarations. The diff view puts the @property section before the initializers, but the reprint of the full BNRItem.h reverses these. Clearly this ordering is more of a convention than an actual compilation issue, however so far it seems like convention in Obj C is important and well-understood by the community. Intuitively I’m figuring properties come after initializers in the header file, but this text is not making that clear to me due to the swapping of the order.


#8

RE "For the More Curious: #import and @import:

I have tried to replace #import <Foundation/Foundation.h> with @import Foundation; but when I do so, I get a build error (Unexpected ‘@’ in program). Am I doing something wrong? I am attempting to insert it in the first line of ‘RandomItems/main.m’.

Thanks!


#9

[quote=“edamron”]RE "For the More Curious: #import and @import:

I have tried to replace #import <Foundation/Foundation.h> with @import Foundation; but when I do so, I get a build error (Unexpected ‘@’ in program). Am I doing something wrong? I am attempting to insert it in the first line of ‘RandomItems/main.m’.

Thanks![/quote]

My apologies…I just read the previous post related to changing the build settings that would allow ‘@import Foundation;’ to work. I have it working now.

Thanks again!


#10

In the eBook where it discusses ‘Navigating with UINavigationController’ under the ‘Pushing view controllers’ paragraph.

It wrongly shows this edit:

The interface entry is what is in the HEADER .h file. In the implementation .m file it should read like so:


#11

The authors seemingly skipped a step when providing a code example for Spring Animations on page 497. Following along exactly as was dictated by the book, no spring animations occurred. I uncovered the problem by comparing my code with the downloadable file from the website. The initial and final coordinates are identical - clearly the reason why no animation occurred!

loadView should look like this:

[code]- (void)loadView
{
CGRect frame = [UIScreen mainScreen].bounds;
BNRHypnosisView *backgroundView = [[BNRHypnosisView alloc] initWithFrame:frame];

CGRect textFieldRect = CGRectMake(40, 70, 240, 30);    // This line needs to be changed to...
CGRect textFieldRect = CGRectMake(40, -20, 240, 30); // ...this line

UITextField *textField = [[UITextField alloc] initWithFrame:textFieldRect];
self.textField = textField;

…[/code]

Now the textField will start offscreen and will bounce onto the screen from the top.


#12

There’s a duplicated word near the bottom of page 83: “Because you had to send the release message to an object to relinquish ownership, the caller of this method had to understand its its ownership responsibilities.”


#13

On page 264, under Threads, it reads ‘shows a the breakdown […]’ which should be either ‘a’ or ‘the’.


#14

Page 79 of the hard copy, very last paragraph, [quote]In BNRItem.m, set the memory management attribute[…][/quote].
Should be [quote]In BNRItem.h, set the memory management attribute[…][/quote]


#15

Page 81 of hard copy, first sentence of 3rd paragraph, [quote]While it is wise to make a copy of an mutable object, it is[…][/quote]
Should be [quote]While it is wise to make a copy of a mutable object, it is[…][/quote]


#16

p. 134: Not a typo but it would be more consistent if the code on p. 134 was similar to that on p. 133, i.e. drop the

UITabBarItem *tbi = self.tabBarItem;

and replace all occurrences of tbi with self.tabBarItem

p. 135: Note: Even when the time changes to the selected time, there may be a delay before the notification.

p. 146: “Many of the messages it sends to its delegates are informative…” note the plural messages.

p. 146: “Some of the messages it sends to its delegates are queries…” note the plural messages.

p. 151: If Reduce Motion setting is off, you will not observe this effect.

p. 152: “Find the line of code in drawRect: that sets the…” note drawRect: instead of initWithFrame:

p. 202: “At the top of BNRItemsViewController.h, import the header file…” note the .h

p. 209: “You can also delete the declaration of the headerView property.” You also need to comment out the lines in viewDidLoad (se p. 182 for the lines)

p. 505: In Figure 28.10 you need to also set the Accessory to Disclosure Indicator in order to match Figure 28.11

p. 513: Figure 28.19 the segue (link) from Table View Controller - Colors to Color View Controller must be added. Simply Control drag from Table View Controller - Colors to Color View Controller, select Push.

p. 514: Somewhere in here the Table View Controller - Colors class needs to be set to BNRPaletteViewController. In the Storyboard, simply click the Palette View Controller, Show the Identity inspector, and select BNRPaletteViewController as the Custom Class.


#17

Greetings,

Figures 7.6 through 7.9 show sections of code from BNRHypnosisViewController.m, while the text on p. 152 says to set a breakpoint in BNRHypnosisView.m.

Thanks.


#18

CGContextSetRGBStrokeColor(currentContext, 1, 0, 0, 1);
is supposed to be
CGContextSetRGBStrokeColor(currentContext, 1, 0, 1, 1);


#19

messageLabel.textColor = [UIColor whiteColor];
is supposed to be
messageLabel.textColor = [UIColor blackColor];
to match the Figure 7.1.


#20
  • (instancetype)init
    {

    {
    is supposed to be
  • (instancetype)init
    {

    }
  • Closing brace typo