Errata

Learning Cocoa with Objective-C

Errata for Learning Cocoa with Objective-C

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date submitted
PDF Page ix
Bottom

The icon that "indicates a warning or caution" is missing.

tops  Oct 26, 2012 
PDF Page 17
Example code

Since 4.4.1 (?) the @synthesize directive doesn't automatically get created in the implementation file.

So, the instance variable "helloButton" in the showAlert: method needs changing to "_helloButton" to work correctly.

tops  Oct 25, 2012 
Printed Page 18
code at top of page

[helloButton setTitle
should be
[_helloButton setTitle


code will not compile as printed in book

Ronnie PItman  Apr 06, 2013 
PDF Page 18
Last line of code sample

The line results in the build error "Use of undeclared identifier 'helloButton'; did you mean '_helloButton'?"

Changing the line to
[_helloButton setTitle:@"I was clicked!" forState:UIControlStateNormal];
clears the error, and the application compiles/runs as expected.

This is in XCode 4.6.2 .. is it possible the conventions have changed since the book was published?

mpounsett  May 28, 2013 
PDF Page 24
Indented Tip

Text reads "after each color."

Should read "after each colon."

tops  Oct 25, 2012 
PDF Page 28
Protocols

Text reads: "To declare a property, you use this syntax:"

Should read: "To declare a protocol, you use this syntax:"

tops  Oct 25, 2012 
PDF Page 29
Second para that starts with "This means that"

Text reads: "Properties are used quite heavily by Cocoa?"

Should read: "Protocols are used quite heavily by Cocoa?"

tops  Oct 25, 2012 
Printed Page 45
First tip

The tip says that `indexOfObject:` compares objects only by identity, whereas `indexOfObjectEqualTo:` compares by equality. In fact, `indexOfObject:` compares by equality, and there is no such method `indexOfObjectEqualTo:`. See also: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html

Jeff Schwab  Jun 29, 2013 
PDF Page 76
3rd paragraph

Windows can contain any view at all. should be : Windows can NOT contain any view at all (I think)

raiden core  Jun 18, 2013 
Printed Page 84
1. Add Constraints ... 2nd paragraph

Last sentence in the 2nd paragraph: "... we're going to add a new constraint."

So, what??? Where is it??? It's missing!!!

Rainer  Feb 12, 2013 
PDF Page 84
Points 1 to 3

The instructions do not lead to a Wrapping Text Field whose height expands and contracts with the height of the window. In fact I can't seem to get it to grow vertically no matter what I try. A Wrapping Text View (not Field, as instructed at the bottom of page 82) seems to resize vertically, but not the Field.

Marc Fearby  May 23, 2013 
PDF Page 98
the whole page

These steps are so succinct that they seem to assume we are XCode experts. We are not. This is why we bought this ebook.

Step 3: What is the view's prototype cell?
Step 4: I can't seem to find the selection style anywhere!
Step 6: "Make the view controller the table view?s data source and delegate." << This point should probably be broken into several sub-points, instructing us what/where to click. I have NO idea what to do here.

It's at this point that I have to walk away from my Mac because NONE of these steps make sense somebody new to XCode, which I believe is the target audience for this book.

Disappointed :-(

Marc Fearby  May 24, 2013 
PDF Page 98
Points 1 and 6

If the steps on this page were prefaced with "Create an iOS app", I would have been right. I assumed that a "Single-View Application" would be a plain Mac App with one window (since the previous example was a Mac App, I continued down that path).

Point 6 could also do with some words around having to drag from the appropriate items in the Connections Inspector to the View Controller in the pane to the left of the main canvas.

Marc Fearby  May 24, 2013 
Printed Page 98
Putting It All Together

The following has been corrected for Xcode 4.6.3

1. Create a new 'Single View Application', iOS project.
2. Select the MainStoryboard and add a 'Table View' object from the Objects library.
3. Use the Control key to drag select on to the View Controller icon and connect both the 'dataSource' and 'delegate' Outlets.
4. Add a 'Table View Cell' object from the Objects library and position it at the top of the screen.
5. Change the 'Table View Cell' object attributes to Style: Basic, Identifier: IconCell and Selection: None.
6. Ignore.
7. Open the ViewController.h in the Assistant and make the ViewController conform to the following protocol:
UITableViewDataSource, UITableViewDelegate
@interface ViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
8. Add a new Outlet under the @interface by control-dragging from the View Controller icon (Main Storyboard) back to the ViewController.h and call it tableView:
@property (weak, nonatomic) IBOutlet UITableView *tableView;

Anonymous  Aug 31, 2013 
PDF Page 110
Creating the Project, Step 3

How to accomplish this step hasn't been explained.. this needs to be broken down into actual steps, not glossed over.

mpounsett  Jun 13, 2013 
PDF Page 164
last line

Missing "@" symbol before the word "property", which I noticed and corrected. I mistakenly thought an asterisk was missing also from the "NSInteger numberValue" part, but NSInteger is, in fact, a primitive type. If you add an asterisk the program will crash and complain about it not being compliant with key-value coding. Were it not for the missing "@" symbol I might have copied/pasted verbatim and not fell into this trap.

Homercycles  Jun 08, 2013 
Printed, PDF, ePub Page 164
Last line

The line:
"property (assign) NSInteger numberValue;"
should have a leading @ symbol.

@property (assign) NSInteger numberValue;

mpounsett  Jun 22, 2013 
Printed, PDF, ePub Page 165
in the Note

"Remember that the AppDelegate object now has a property, called val ue, which stores an integer" is incorrect. The property is called 'numberValue'.

mpounsett  Jun 22, 2013 
Printed, PDF, ePub Page 166
First paragraph

"The key that we want to bind to is value, because that?s the name of the property in the app delegate object" is incorrect. The key is "numberValue".

mpounsett  Jun 22, 2013 
Printed, PDF, ePub Page 172
Third last paragraph

The instructions to expand "the entire tree" aren't clear. The book has been dealing with the Inspectors (far right of the screen) this whole time, and doesn't clearly move the reader's attention over to the Objects tree on the left. The problem is exacerbated by the fact that the most recently selected Inspector (Attributes) has a "Scroll View" category at the top with an arrow next to it that can be expanded, which leaves the reader wondering why the Inspector doesn't seem to show the other things described.

mpounsett  Jun 22, 2013 
Printed, PDF, ePub Page 173
Step 5, First paragraph

It looks like the second sentence is made up of parts from two different drafts, and makes little sense.

"For a finishing touch, we?re going to disable the remove button be disabled if there?s nothing to remove or if there?s no selected object."

mpounsett  Jun 22, 2013 
PDF Page 174
point 2, second half

We need to bind the "data" value to for the NSTextView. This could be clarified.

Homercycles  Jun 09, 2013 
Printed, PDF, ePub Page 174
Point 2, second half

The instructions say to set the value for the text field, but there are four values that can be set (XCode 4.6): Attributed String, Data, Value Path or Valueurl. It's the Attributed String which needs to be set.

The reader could deduce this from the parameter type set in the App Delegate, but being specific in this text would make things clearer and avoid throwing exceptions.

mpounsett  Jun 22, 2013 
Printed, PDF, ePub Page 185
Step 4

AppDelegate.m needs to import "Song.h" in order for the Song object to be available.

mpounsett  Jun 23, 2013 
PDF Page 186
Point 5, second half

I couldn't control drag either of these two things onto the other until I continued the steps up to page 188; when I ran the program, nothing happened, but only after completing the remaining steps would XCode allow me to control-drag the app delegate onto the array controller. Something (not sure which) has to be done first before you can do this.

Homercycles  Jun 09, 2013 
PDF Page 202
2nd line at the top

textField should be _textField, unless you also direct readers to synthesize textField at the top of page 201.

Homercycles  Jun 10, 2013 
PDF Page 205
dataOfType: method

With Xcode 4.6 and OS X 10.8.2,

NSError *error = nil;
NSData* serializedData = [NSJSONSerialization
dataWithJSONObject:dictionary options:NSJSONWritingPrettyPrinted
error:error];

The NSData line throws an error when compiling:

"Implicit conversion of an Objective-C pointer to 'NSError *__autoreleasing"' is disallowed with ARC"

It also throws a warning:
"Incompatible pointer types sending 'NSError *__strong' to parameter of type 'NSError *__autoreleasing *'"

I have no idea what these mean, or how to fix the code so it builds.

Andy Peters  Feb 10, 2013 
PDF Page 205
code lines containing "error:error"

In answer to Andy Peters' erratum submitted on Feb 10, 2013 (no less!) is to precede the second "error" with an ampersand -i.e., "error:&error"

Are errata being checked anymore for this ebook? Is it now deprecated or something? Nothing seems to be happening to these submissions. Very worrying indeed for a third edition to have so many silly mistakes.

Homercycles  Jun 10, 2013 
PDF Page 208
point 14

It took me a few readings to guess at what we have to do here. It seems that we have to control-drag from the detail view to the "Detail" header bar at the top of the very same window (or "view controller"). To the non-XCode initiated (which is your target audience :-), this might need pointing out more explicitly.

Homercycles  Jun 11, 2013 
Printed, PDF Page 228
AppDelegate.h listing

When you control-drag from the spinner to AppDelegate.h, it creates the following line:

@property (weak) IBOutlet NSProgressIndicator *spinner;

The code excerpt on page 228 changes the line to:

@property (weak) IBOutlet NSLayoutConstraint *spinner;

When makes these lines on p. 229 not compile:

[self.spinner stopAnimation:nil];

[self.spinner startAnimation:nil];

What control-dragging creates is correct, and is what is in the downloadable example source.

Syd Polk  Jul 15, 2013 
Printed, PDF Page 228
applicationDidFinishLaunching: method

So, when this sample app is launched, the spinner does not spin. As a matter of fact, the only way the spinner starts spinning is if there is an error. I added

[self.spinner startAnimation:nil];

as the first line in applicationDidFinishLaunching:


- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[self.spinner startAnimation:nil];

_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
[_locationManager startUpdatingLocation];
}

Syd Polk  Jul 15, 2013 
PDF Page 256
sentence before step 1

Doesn't look like the source code for TextEdit comes with XCode any more. It can be downloaded here: http://developer.apple.com/library/mac/#samplecode/TextEdit/Introduction/Intro.html

Marc Fearby  Jul 10, 2013