Errata

Head First iPhone Development

Errata for Head First iPhone 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 xxviii
5th paragraph

"Even crosswords puzzles are imporant??they'll help get the concepts into your brain the way you'll see them on the PMP exam."

PMP exam in an iPhone programming book?

Note from the Author or Editor:
remove "the way you'll see them on the PMP exam"

Anonymous  Nov 06, 2009 
xxviii
3rd paragraph, last line

"it's glorious gotchas" should be "its glorious gotchas" (i.e. no apostrophe in "it's")

Note from the Author or Editor:
Change the "it's" to "its"

Anonymous  Dec 30, 2009 
PDF
Page xxvii
item 9

In item 9, "Create something!", some text sounds like it came from the PMP book, as it talks about projects and the exam.

Apply this to your daily work; use what you are
learning to make decisions on your projects.

a problem that might benefit from using the tools and techniques
you?re studying for the exam.

Note from the Author or Editor:
Remove item #9 from this page.

Anonymous  Jan 03, 2010 
PDF
Page xix
1st paragraph

"castor" is beaver or star, and should be "caster".

http://en.wikipedia.org/wiki/Caster says:
"A caster (or castor) is an undriven, single, double, or compound wheel mounted on an object to make movement easier. ..."

Note from the Author or Editor:
Change "castor" to "caster" on p. xix and p. 487

Chasmeister  Jan 31, 2010 
Printed
Page x
Last sentence of paragraph

The last sentence of the paragraph "Apple provides the software and we'll help you the knowledge;..."

Seems like there is a word missing after "you" like maybe 'get' or 'with'. Either way it doesn't sound right.

Thanks for the great publication!

Marc

Note from the Author or Editor:
Change the sentence to read "Apple provides the software and we'll help you with the knowledge;..."

Anonymous  Mar 14, 2010 
30
Answer to first question on page

"Since the File?s Owner is set up to be our
iDecideViewController, Interface Builder
could look at the iDecideViewController
header and see we had an IBOutlet named
descriptionText and an IBAction named
button pressed."

In the above sentence, the IBOutlet variable in the code is named decisionText, not descriptionText.

Note from the Author or Editor:
Change the reference in the answer to the first question from "descriptionText" to "decisionText"

Marc K.  Apr 26, 2010 
30

"Q: What is that File?s Owner thing?
A: Interface Builder has an expectation
of what class will be the nib?s File?s Owner.
You can change what class Interface Builder
thinks it will be, but by default a new project
is set up so that the main View Controller
created by Xcode is the File?s Owner for
the main view created by Xcode."

This is not clear at all. Did you mean "nib File's owner"?

Note from the Author or Editor:
Change "nib's" to nib.

Marc K.  Apr 26, 2010 
33
Clue for 12 Across

Isn't the name of the IDE for iPhone apps "XCode"?

Perhaps the clue should be: The name of the tool for building graphical iPhone user interfaces? [or similar]

Note from the Author or Editor:
Change the clue for number 12 to "The name of the tool for building iPhone UIs"

Anonymous  Feb 16, 2010 
Printed
Page 61
First item in the list of Picker characteristic or method

There is an inconsistency with the quiz on page 61 and the answers on page 62.

The first item in the left column on page 61 is "Directions for drawing the view for the items"

In the answer key on page 62 the same item says "Directions for drawing the rectangles for the items"

Note from the Author or Editor:
Change the first item in the "Picker Characteristic" column from "Directions for drawing the rectangles" to match p. 61 and read "Directions for drawing the view for the items"

Trevor George  Nov 12, 2009 
Printed
Page 66
In code sample

It currently has this in the code sample:

(NSInteger)pickerView:(UIPickerView *)pickerViewnumberOfRowsInComponent :(NSInteger)component {
if (component == 0)

There needs to be a space between "pickerView" and "numberOfRowsInComponent" like this:

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent :(NSInteger)component {
if (component == 0)

Note from the Author or Editor:
There should be a space between the pickerView and numberOfRowsInComponent as described above.

Anonymous  Nov 03, 2009 
Printed
Page 66
middle of page - middle of code snippet

the line of code that begins with:
pickerViewnumberofRowsInComponent

There should be a space before numberOfRows, i.e.:

pickerView numberOfRowsInComponent

Code will compile and run but expected result will not be achieved.

Nick Baynham  Nov 03, 2009 
Printed
Page 66
Code section

The code on page 66 is not referenced to any particular spot in the InstatwitViewController.m section of code as other references to code are. There is no preceding or following code sections to reference it to a spot in the actual InstatwitViewController.m code.

Note from the Author or Editor:
It doesn't really matter where the code is implemented, but we should probably add an annotation that says "Implement this code after the viewDidLoad"

Anonymous  Mar 19, 2010 
PDF
Page 79
code example, 5th row

The statement "NSLog(themessage);" produces a warning: "passing argument 1 of 'NSLog' from incompatible pointer type".

Should be:
NSLog(@"%s", themessage);

Note from the Author or Editor:
in the code, change NSLog(the message) to NSLong(@"%s", themessage);

Michael Schroeder  Jun 11, 2010 
Printed
Page 81
first statement 5th row of TWITTER BLACK MAGIC

The arrow is obscuring a left [ bracket which is hard to see. I thought this was a typo but now I see there's a drawn arrow through the bracket hiding it. I had a difficult time compiling this until I realized the number of brackets didn't match up then trial and error substituted one where I thought it made sense.

Note from the Author or Editor:
Relocate the annotation "Your username and password need to go in here" so that the arrow is not passing through code.

Nick Baynham  Nov 12, 2009 
Printed
Page 81
//TWITTER BLACK MAGIC

If your twitter username or password contains a character which requires URL-encoding (in my case, it was a "#"), the program will compile and run without error, but no tweet will appear. I fixed the problem by replacing "#" with "%23" in my password in the "BLACK MAGIC" code. Another workaround, of course, is to change your password so it has no such characters.

Note from the Author or Editor:
Twitter no longer supports this type of authorization. See http://forums.oreilly.com/content/Head-First-iPhone-Development/20760/Twitter-Oauth-Changes-And-Instatwit/ for more details.

hocohiker  Feb 10, 2010 
Printed
Page 81
Twitter Black Magic

Oops, take 2:

The Twitter Black Magic snippet doesn't work in 3.1.3. Looks like NSMutableURLRequest has changed. The following worked for me (don't forget to edit user:password):

NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://user:password@twitter.com/statuses/update.xml"]];
[theRequest setCachePolicy:NSURLRequestUseProtocolCachePolicy];
[theRequest setTimeoutInterval:60.0];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:[[NSString stringWithFormat:@"status=%@",tweetStr] dataUsingEncoding:NSASCIIStringEncoding]];
NSURLResponse *response;
NSError *error;
NSData *result = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];
NSLog(@"%@",[[[NSString alloc] initWithData:result encoding:NSASCIIStringEncoding] autorelease]);

Note from the Author or Editor:
Twitter no longer supports the authorization protocol we used. See http://forums.oreilly.com/content/Head-First-iPhone-Development/20760/Twitter-Oauth-Changes-And-Instatwit/ for details.

Anonymous  Apr 14, 2010 
Printed
Page 81
2nd paragraph

Twitter API no longer supports basic authentication. The code in the book results in
<errors>
<error code="53">Basic authentication is not supported</error>
</errors>

Note from the Author or Editor:
Unfortunately, Twitter has changed their authorization protocol. Please see http://forums.oreilly.com/content/Head-First-iPhone-Development/20760/Twitter-Oauth-Changes-And-Instatwit/ for details.

Pranav parthasarathy  Sep 04, 2010 
Printed
Page 92
Inset image containing header file code.

IBOutlet UIPickerView *tweetPicker; is not indented consistently with the other declarations within the graphic.

Note from the Author or Editor:
Indent the "IBOutlet UIPickerView *tweetPicker;" line of code with the other lines of code.

Reid Mullen  Dec 17, 2009 
Printed
Page 105
Line next to numeric 4

dictionary is misspelled as dicionary

Note from the Author or Editor:
please change the word "dicionary" to "dictionary" (approx 1/2 way down the page on the left hand side).

Donald L Smith  Nov 28, 2009 
Printed
Page 106
middle right, handwritten text end of sentence

command on the linthat's already there.

should be

command on the line that's already there.

Note from the Author or Editor:
chnage "linthat's" to "line that's"

Donald L Smith  Nov 28, 2009 
Printed
Page 110
Next to last answer, next to last sentence

release it if you ant to use it later.

should be

release it if you want to use it later.

Note from the Author or Editor:
chnage "ant" to "want"

Donald L Smith  Nov 28, 2009 
Printed
Page 110
first column of Q/As, last paragraph, 4th line

"used, peak memory usage, how fast your"

should be

"....how fast you are" OR "....how fast you're"

Note from the Author or Editor:
change "used, peak memory usage, how fast your" to "you're"

TheWB  Jan 25, 2010 
PDF
Page 116
Second picture, where sendButtonTapped is declared

Not so important, but confusing on a first sight. The response, declaration and parameters are displaced form the arrows pointing to them.

Ramon M. Gallart

Note from the Author or Editor:
The second code snippet needs to be re-formatted so that the arrows point directly to the reference (the IBAction code needs to be immediately next to the dash and it will all work).

ramagaes  Nov 12, 2009 
Printed
Page 126/127
middle

The Test Drive on pg. 127, using the code from pg. 126, should produce 2 periods at the end of the first sentence of the Tweet?one from the user input, one from the pattern.

Note from the Author or Editor:
Change the input for the custom text field on p. 127 from "Renee is so awesome." to remove the period.

Tom  Jan 31, 2010 
Printed
Page 134
Description of picture

On page 134 the ingredient and instruction fields are presented as UIScrollView. On page 157 they are stated as UITextView.

Note from the Author or Editor:
On p. 133 and p.134, the annotation that reads "UIScrollView" needs to be changed to "UITextView"

Anonymous  Aug 02, 2010 
Printed
Page 153
Ready Bake Plist

In several spots in book you refer to getting files from "http://www.headfirstlabs/iphonedev"

I tried this several times -- it is wrong. The correct site should be www.headfirstlabs.com/iphone dev -- you need the .com in the addresses in the book!!!

Note from the Author or Editor:
All mentions of the website should be "http://www.headfirstlabs.com/iphonedev

tpmchugh  Dec 17, 2009 
Printed
Page 159
2nd sentence of the first answer of the Q&A

The sentence "In general, you'll have a FEW defined in a nib...". I believe it should be a VIEW defined in a nib.

Note from the Author or Editor:
change "few" to "view" in the second sentence of the first answer.

TrevorNYC  Mar 25, 2010 
Printed
Page 164
Exercise Solution, first paragraph

The text is:

"We need to disable both the UITextField and the two UITextViews to prevent the user from making changes. Simply click on each field and toggle the Enabled checkbox to off."

The accompanying graphic has an arrow pointing to the "Editable" (not "Enabled") checkbox for a UITextView; UITextViews do not have an "Enabled" checkbox (in IB 3.2.1 (740)). UITextFields, on the other hand, have an "Enabled" checkbox but do not have an "Editable" checkbox.

Note from the Author or Editor:
Change the word "Enabled" to "Editable" for the second paragraph of the exercise solution.

Jim Matthews  Nov 19, 2009 
Printed
Page 172
Screenshot

"DrinkDirections.plist" should be "DrinksDirections.plist"

Note from the Author or Editor:
Update screenshot with the proper file name.

Anonymous  Mar 05, 2010 
Printed
Page 173
Ready Bake Code directions

The directions say to download "DrinksDirections.plst". The correct file name is "DrinksDirections.plist".

Note from the Author or Editor:
Update page 173 directions to say "DrinksDirections.plist"

Jim Matthews  Nov 19, 2009 
Printed
Page 175
First sentence in Geek Bits

The first sentece looks like "Some common warning culprits:."

The dot at the end has to be removed.

Note from the Author or Editor:
Remove the "." at the end of the first sentence inside the "Geek Bits"

Anonymous  Aug 02, 2010 
Printed
Page 180
Screenshot

Screenshot contains the text "DrinkDirections" which should be "DrinksDirections"

Note from the Author or Editor:
Update screenshot with the proper file name.

Anonymous  Mar 05, 2010 
Printed
Page 184
5 Down

The answer for 5 Down of this crossword should be "NSSTRING" rather than "NSSRING" (and therefore the puzzle needs another square for the missing letter, on both page 182 and page 184).

Note from the Author or Editor:
The crossword needs to be updated to change the answer to NSSTRING - so both crossword forge files will need to be updated to add a square.

Jim Matthews  Nov 19, 2009 
Printed
Page 194
Screenshot and Brain Power

References to file "DrinkDirections.plist" should be "DrinksDirections.plist"

Note from the Author or Editor:
Update all references to DrinkDirections.plist to DrinksDirections.plist

Anonymous  Mar 05, 2010 
202
Table Cells Up Close section - handwritten notes for accessoryType - common ones are...

"detailed disclosure indicator" should be "detail disclosure button", i.e. detailed -> detail; indicator -> button.

ALSO in Sharpen Your Pencil Solution on same page AND Sharpen Your Pencil PAGE 201:

"detailed disclosure button" should be "detail disclosure button"

Note from the Author or Editor:
p. 201, Sharpen, 2nd Question - change "detailed disclosure" to "detail disclosure"

P. 202 Sharpen solution, 2nd question - change "detailed disclosure" to "detail disclosure"

p.202 - annotation that starts "accessoryType", change "detailed disclosure indicator" to "detail disclosure button"

Anonymous  Jan 06, 2010 
209
Option #2 graphic

The new toolbar is appearing over the nav controller, not under it as it should be (the graphic is correct on the following page 210).

Note from the Author or Editor:
Change the option #2 graphic on page 209 to match the option #2 graphic on p. 210

Anonymous  Jan 06, 2010 
PDF
Page 212
Example #2

@interface RootViewController : UITableViewController {
NSMutableArray *drinks;
IBOutlet UIBarButtonItem *addButtonItem;
}
@property (nonatomic, retain) NSArray *drinks;
@property (nonatomic, retain) UIBarButtonItem *addButtonItem;
- (IBAction) addButtonPressed: (id) sender; @end
---------------------------------------------------------
drinks is first defined as NSMutableArray on PG 144 but here when @property is defined its defined as NSArray and not NSMutableArray.

Change NSArray to NSMutableArray in the @property definition to match PG 144.

Note from the Author or Editor:
Change NSArray to NSMutableArray in the @property definition to match PG 144 in code snippet for item #2.

Anonymous  Mar 29, 2010 
219
Written text snippet at the bottom

"So when we create an AddDrinkDetailViewController, it will ask its superclass, the DetailDrinkViewController, to load the DetailDrinkViewController.xib"

The two instances of "DetailDrinkViewController" above should be "DrinkDetailViewController".

Note from the Author or Editor:
Change both instances of "DetailDrinkViewController" to "DrinkDetailViewController"

Beau Randall  May 05, 2010 
Printed
Page 221
Second item in "Sharpen Your Pencil"

In two spots, this typo should be fixed:

DetailedDrinkViewController should be DrinkDetailViewController

Note from the Author or Editor:
Replace "DetailedDrinkViewController" with "DrinkDetailViewController"

Mathias Fleck  Jan 27, 2010 
Printed
Page 222
Top of page in "Sharpen your pencil solution"

The penciled paragraph says "In order to use the DetailDrinkView Controller, we need ...".

This is referring to the DrinkDetailViewController and should read "In order to use the DrinkDetailViewController, we need ..." - which is exactly what the printed material below shows.

Note from the Author or Editor:
Revise the annotation to say "In order to use DrinkDetailViewController"

tim burlowski  Jan 02, 2010 
Printed
Page 222
Bottom of Sharpen your pencil

At the bottom of the "Sharpen your pencil" section there is a sentence that reads; "The AddDetailViewController.m file can stay exactly as it is generated by Xcode." AddDetailViewContoller.m should be AddDrinkViewController.m

Note from the Author or Editor:
Change the reference of "AddDetailViewController.m" to "AddDrinkViewController.m"

Anonymous  Apr 11, 2010 
Printed
Page 231
1st Paragraph (cursive callout text)

The cursive callout text refers to "DetailedDrinkViewController" when it should be "DrinkDetailViewController"

?just like the DetailedDrinkViewController?
should read
?just like the DrinkDetailViewController?

No big deal but it made me panic and go back through all the code thinking i had used the wrong name!
(P.S. This is my first Head First book and I'am loving the presentation and writing style)

Note from the Author or Editor:
Change "DetailedDrinkViewController" to "DrinkDetailViewController" in the annotation at the top of the page.

Mark Rogerson  Dec 09, 2009 
Printed
Page 234, 236
3-down

Answer to 3-down is given as 'Indentifier'. That's not even a word. The further I get into this book, the more frustrating (and time-consuming) its typos are.

Note from the Author or Editor:
The word should be "identifier" this crossword puzzle will need to be regenerated.

Dave Robeson  Jan 15, 2010 
Printed
Page 246
Final block of code

Final block of code displays [nameField release] when the code as referenced in earlier examples calls for [nameTextField release]

Note from the Author or Editor:
Fix the un-bolded code in the bottom right corner of the page. Change [nameField release]; to [nameTextField release]

RyanGarcia  Jul 24, 2010 
Printed
Page 256
file name

The code should be in the AddDrinkViewController.m but the title shows AddDrinkViewController.h (the small graphic shows ".m" which is correct.

Note from the Author or Editor:
change the caption text underneath the first code snippet to "Add DrinkViewController.m", not .h.

Anonymous  Dec 15, 2009 
Printed
Page 256
second code fragment

the second } in the added code to AddDrinkViewController should be removed.

Note from the Author or Editor:
Remove the } brace above the first - (void) method.

rfausak  Jan 03, 2010 
Printed
Page 256
second code fragment (.h)

The second } in the added code to AddDrinkViewController should be removed (as rfausak says).

The errata note from Author/Editor is wrong.

Note from the Author or Editor:
Remove the second }

Anonymous  Mar 05, 2010 
Printed
Page 266
last paragraph

Extraneous characters "the" (right before setObjectForKey:) in the sentence "We can set the drink on the dictionary using thesetObjectForKey:."

Note from the Author or Editor:
remove "the" at the beginning of "thesetObjectForKey:"

Jim Matthews  Nov 30, 2009 
PDF
Page 280
End of page

The code for sorting the array of drinks must be on AddDrinkViewController.m but in the page shows the icon and name for RootViewController.m.

Ramon M. Gallart Escol

Note from the Author or Editor:
Change the icon on the code at the bottom of p. 280 to indicate AddDrinkViewController.m, not RootViewController.m

ramagaes  Nov 18, 2009 
Printed
Page 284
various

There is some discrepancy between the usage of DrinksDirections (Page 173) and DrinkDirection (Page 172 and 284) - note the plural Drinks vs. Drink.

I believe the download has two plsts under each name...

Note from the Author or Editor:
All references should be drinkdirections.plist. We'll need to update the code so that is the only plist to download.

James Bennett  Nov 11, 2009 
Printed
Page 284
Don't forget point between 1st and 2nd code change

Don't forget to declare this in RootViewController.h, too

Should be

Don't forget to declare this in RootViewController.m, too

The method should be added to the class not the header

Note from the Author or Editor:
Change the annotation that says "Don't forget to declare this in RootViewController.h" to "Don't forget to declare this in RootViewController.m"

Jim Stewart  Nov 28, 2009 
Printed
Page 284
2nd code snippet

I'm not sure if the errata for the penciled note above the 2nd code snippet that reads "Don't forget to declare this in RootViewController.h, too" is correct. Everything on the page relates to IMPLEMENTATION, which should happen in RootViewController.m (as shown by the icon at the top right). However, you must also DECLARE any new methods you IMPLEMENT. The penciled note should read something like:

Don't forget, we're *implementing* a new method here in RootViewController.m so we also need to *declare* this new method in RootViewController.h

Essentially you just copy the first line of the method implementation (minus the left brace):

- (void)applicationWillTerminate: (NSNotification *)notification

to the RootViewController.h file, which is what the penciled note is trying to get at.

Note from the Author or Editor:
Change the second annotation on the page "Don't forget..." to

"Implement this code in RootViewController.m and you'll also need to declare the method in RootViewController.h"

Tena Colombel  Apr 08, 2010 
Printed
Page 286
3rd sentence of 1st answer

Sentence as printed starts, "Any objects you want to load an save" but the "an" should be "and".

Note from the Author or Editor:
change the "an" to "and" in this sentence: "Any objects you want to load an save"

David Robeson  Jan 22, 2010 
Printed
Page 316
2nd paragraph

"...delete those the view controllers..." - something in that fragment is missing or extra

Note from the Author or Editor:
change to "delete those view controllers"

James Bennett  Nov 11, 2009 
Printed
Page 316
between steps 2 and 4

Instruction to change the name of the Navigation Item in the view controller is missing. If this step is omitted, the title on each tab view during the second test drive on p. 326 will be "Root View Controller" instead of "Fugitives" or "Captured". Changing Tab Bar Item and view controller will not be sufficient.

Note from the Author or Editor:
This is implied in the listing for the mainwindow.xib, but not directly specified. Add an annotation on the bottom of p. 316 that says "Be sure to change the title of the navigation item as well"

Darrel Plant  Apr 23, 2010 
Printed
Page 336
screen shot

Note the spelling of the attribute "fugtive" (no 'i') - which should be "fugitive" (page 342). It is also messed up on page 343 of the code listing of Fugitive.m and possibly a few other places.

If you use the misspelled version, you'll get "The model used to open the store is incompatible" later on...

Note from the Author or Editor:
Fugitive should be spelled "fugitive" in all locations.

James Bennett  Nov 11, 2009 
Printed
Page 337
Question at bottom of middle column

"What other types of persistance does..."

The 'a' in persistance should be an 'e'.

It's spelled correctly in the answer.

Note from the Author or Editor:
Change "What other types of persistance does Core Data support?" to "persistence"

iversonc  Apr 16, 2010 
Printed
Page 346
2nd paragraph

Second para reads:
"code needs to go into viewWillAppear in FugitiveViewController.m"
There is no FugitiveViewController - text should read
"code needs to go into viewWillAppear in FugitiveListViewController.m"

Sharpen your pencil, point 1 text:
"Create an array in the FugitiveViewController called"
should read
"Create an array in the FugitiveListViewController called"

Sharpen your pencil, point 2 heading:
"Import the appropriate headers into FugitiveViewController.m."
should read
"Import the appropriate headers into FugitiveListViewController.m."

Note from the Author or Editor:
Change all references from "FugitiveViewController.m" to "FugitiveListViewController.m"

Mark Rogerson  Dec 20, 2009 
Printed
Page 348
Bullet point 2 bold text

"Import the appropriate headers into FugitiveViewController.m."
should be
"Import the appropriate headers into FugitiveListViewController.m."

Note from the Author or Editor:
Change reference from "FugitiveViewController.m" to "FugitiveListViewController.m"

Mark Rogerson  Dec 20, 2009 
Printed
Page 350
middle of page

On line starting with "UITableViewCell *cell = " the Table Cell Magnet obscures the opening left brace [.

Note from the Author or Editor:
Shift the magnet slightly to the right.

iversonc  Apr 16, 2010 
PDF
Page 401
Bottom of the page

One of the magnets shown says 'x == 0'. Should be '== 0' (without the 'x').

Ramon M. Gallart

Note from the Author or Editor:
Change the magnet at the bottom of p. 401 to be "== 0" (remove the x and the extra close paren). The code on p. 402 is correct.

ramagaes  Nov 20, 2009 
Printed
Page 401 402
Toggle Code Magnets

The code as written is missing the opening curly brace "{" after "sender"

Note from the Author or Editor:
Add a { following "sender" in the first line of code. This is true for both pages 401 and 402.

Jon Hovland  Jun 19, 2010 
Printed
Page 479
2nd code block (Fugitive.m)

The code to be added to Fugitive.m is missing a leading minus sign:
(CLLocationCoordinate2D) coordinate
should read
- (CLLocationCoordinate2D) coordinate

Note from the Author or Editor:
Add the "- " before (CLLocationCoordinate2D)

Mark Rogerson  Dec 30, 2009