Errata

Head First iPhone and iPad Development

Errata for Head First iPhone and iPad Development

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 278
2nd question of sharpen your pencil solution

The question is "where do we need to add code?" and the answer doesn't inform where.

Note from the Author or Editor:
Clarify response.

cristiane santos  Aug 30, 2011 
196
crossword

Down 5, The @ symbol is shorthand for creating one of these - the "T" is missing in "NSString" (in the crossword as well as in the solution text).

Note from the Author or Editor:
p. 196, p. 194. 5 down needs to be changed to "NSString", and one additional box is needed in both locations.

Nicola Kellner  Aug 27, 2011 
Printed
Page 225
Step 4

As noted by Philip MacIntosh, the random connector line causes nothing but confusion and the image should be removed

As discussed in the forum, the correct sequence is to
1. right-click File's Owner
2. move popup menu window over if needed
3. Connect Outlets:addButton and Recieved_Actions:addButtonPressed to the Bar_Button_Item icon

Note from the Author or Editor:
The screen shot got displaced from the annos and connector lines. Please relocated the straight connector line down to draw between "File's Owner" on the left and the addButtonPressed: File's Owner button on the right.

Then relocate the arrow on the right so that it points to the "Identifier" item on the right.

John Soper  Aug 19, 2011 
Printed
Page 223
Step 1

The term "Main Window" is incredibly misleading because a Bar Button Item CAN be visually added to the upper right corner of MainWindow.xib which has confused more than one reader.

A better instruction would be "drag a Bar Button Item to the Placeholders and Objects pane (just to the right of the file tree) and drop it below the Table View icon".

Note from the Author or Editor:
This is an artifact from Xcode 3.2. Agree that we should change number 1 to:

"Scroll through the library and drag a Bar Button Item to the Placeholders and Objects pane (just to the right of the file tree) and drop it below the Table View icon. It won't show...." (continue with the rest of the existing instruction.

John Soper  Aug 19, 2011 
Printed
Page 215
New Code

UITableViewCellAccessoryDetailDisclosureIndicator; should be
UITableViewCellAccessoryDisclosureIndicator;

Note from the Author or Editor:
This is an artifact of an earlier version of the app that used the detail disclosure indicator. Please change the code in the code block to be "UITableViewCellAccesoryDisclosureIndicator;"

John Soper  Aug 17, 2011 
PDF
Page 423
code paragraph

NSURL *defaultDBPath = [[[NSBundle mainBundle

should be

NSURL *defaultDBPath = [[NSBundle mainBundle

Note from the Author or Editor:
Remove one [ before NSBundle in the code.

Anonymous  Aug 17, 2011 
Printed
Page 163
exercise step 1

step 1 should say "Select New File->Mac OS X Resource" and then select "Resource" in the dialog

Note from the Author or Editor:
Revise the direction to say "Select New File -> Mac OS X -> Resource"

Rusty Fadgen  Aug 09, 2011 
PDF
Page x
All along the section

Not so important really. Just that the bookmarks all over the table of contents section do not point to the pages where they should point to.

Cheers.

Ramon M. Gallart

Note from the Author or Editor:
The PDF table of contents isn't linked properly. The chapter links work fine, but the links directly from the table of contents to the rest of the books appear to not have been updated from V1.

ramagaes  Jul 20, 2011 
PDF
Page 286
Debugger command example

In the example, we can use this command to ask the debugger a specific value of an element in the array:

p (char *)[[[self.drinks objectAtIndex:0] objectForKey:@"name"] UTF8String]

It doesn't work because the variable name is drinks_ not drinks. "drinks" is the name of the property.

So the right code is: p (char *)[[[self.drinks_ objectAtIndex:0] objectForKey:@"name"] UTF8String]

Here is an example of the output from the debugger:

---

2011-07-13 15:32:33.807 DrinkMixer[5559:207] Save pressed!
(gdb) p (char *)[[[self.drinks objectAtIndex:0] objectForKey:@"name"] UTF8String]
There is no member named drinks.
(gdb) p (char *)[[[self.drinks_ objectAtIndex:0] objectForKey:@"name"] UTF8String]
$1 = 0x4b444c0 "After Dinner Mint"


Note from the Author or Editor:
Revise the variable to be self.drinks_

Pietro Zuco  Jul 12, 2011 
PDF
Page 346
Source Code example

There are two source code examples.
One for RootViewController.h and one for RootViewController.m

The first section of code indicates in the right icon that the target is RootViewController.h

The second section of code, indicates int he right icon that the target is RootViewController.h but it should be RootViewController.m

Note from the Author or Editor:
Change the label under the .m file icon to read "RootViewController.m"

Pietro Zuco  Jul 03, 2011 
PDF
Page 334
Source Code example

In the source code, the conditional part, the parameter is wrong.

Current:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[self.window addSubview:self.splitViewController.view];
}
else
{
[self.window addSubview:navigationController.view];
}

Correction:


if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[self.window addSubview:self.splitViewController.view];
}
else
{
[self.window addSubview:self.navigationController.view];
}

Look at the last line in the "else" zone. self.navigationController instead of just navigationController

Note from the Author or Editor:
Change the code example. The bracketed code after "else" should read [self.window addSubview:self.navigationController.view];

Pietro Zuco  Jul 03, 2011 
PDF
Page 181
Source Code example

In the source code example, the last line:

[DrinkDetailViewController release];

should be:

[detailViewController release];

In fact in the source code that can be downloaded from the site, we can see that it's detailViewController instead of DrinkDetailViewController.

Note from the Author or Editor:
Change the code on p. 181 to be [detailViewController release].

Pietro Zuco  Jul 03, 2011 
PDF
Page 70
picture in the middle

Comment "How many rows in each component? They come from different arrays, so we need to treat them separately." and their arrows are misplaced, pointing somewhere above of the lines of code they should.

Note from the Author or Editor:
Drop the annos and arrows to point to the different array names (activities and feelings)

AJGM  Jun 22, 2011 
PDF
Page 90
Code example

In the code preview, there is a syntax that can cause confusion.
The code declares a method:

- (void)mailComposeController: (MFMailComposeViewController*) controller
didFinishWithResult: (MFMailComposeResult)
result error: (NSError*) error; <--- HERE

{
[self dismissModalViewControllerAnimated: YES];
}

The " ; " is valid after the method declaration, but it's not used in other parts of the code. For a beginner this can cause confusion, specially for people coming from C.

Cheers

Pietro

Note from the Author or Editor:
We should probably remove the ;

Pietro Zuco  Jun 15, 2011