p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: iPhone and iPad App 24-Hour Trainer (http://p2p.wrox.com/forumdisplay.php?f=686)
-   -   Current Errata additions (http://p2p.wrox.com/showthread.php?t=88634)

gbacklin October 21st, 2012 08:07 PM

Current Errata additions
 
Here is a composite of all emails with errata I have received from readers.

page 14
point 3.2…doesn't state new color to be set.
page 14
point 5.4…the image files are NOT on the DVD. They are in the source code download.
pages 58-59 in the Lesson 4 Try It
there is no mention of @synthesize textLabel.
This is a major gaffe for an introduction to outlets and actions.
the statement does show in the video. I hope my students find it.


Here are some issues I came across in Chapter 5.
Some are not errata but are due to Xcode updates.

Page 69: Step 1 incorrectly identifies the project as FruitList. It’s FruitTest.
Page 71: Step 4.2 should be after the line @implementation Lesson5ViewController.
Page 72: Step 5.3 should be select the Objective-C Class (in Xcode 4.5.1).
Page 75: Omission after Step 5, @synthesize all outlet properties in the FruitDetailViewController.m file.
Page 76: Step 12.3, only one segue circle may show up in Xcode . If 4.5.1. The three segue choices appear when mouse is released. Select Modal.
Page 78: Step 13.2, omission...should be “method in” Lesson5ViewController.m.
Page 79: Step 13: the dataObject errors will fix up after Step 15.

Possible Errata after page 79:

At this point, I have gone through Lessons 1-9. The latter chapters are mostly error-free. A recurring issue has been the omission of @synthesize statements. I note these below. The videos are a big plus.

page 90, insert @synthesize reminder between Steps 7.5 and 7.6.
page 90, Step 8.5 has a typo…should be "Add the following lines".
page 100, insert new Step 4.3 informing reader to @synthesize userLabel.
page 108, need @synthesize reminder for largeImage and animatedImage.
page 116, you kindly mention @synthesize in Step 4.2 but didn't include cityAndSubjectPicker.

1. page 121: initWithTimeIntervalSinceReferenceDate creates a date
relative to midnight on January 1, 2001. You were thinking of initWithTimeIntervalSince1970.
2. page 121 minor typo in last line on page…should be textualRepresentation.

I would like to thank all readers who have brought these to my and the publisher's attention.

Take Care,
Gene Backlin

RonMcMahon February 24th, 2013 10:59 PM

Could you explain @Synthesize For Us?
 
I picked up this book yesterday after struggling along with a couple of other authors. Your writing style and comprehensive definitions of what is where and how things work is a perfect match for my learning style.

As you may have expected, I stumbled once I hit Chapter 4 with the missing @synthesize instructions. I haven't found any reference to @synthesize in the index either, so perhaps coverage of this is completely missing from the book(?)

If this is so, could you be so kind as to post a definition and description of @synthesize in the same style as is used in the book so that I can wrap my mind around the how and why of @synthesize? (VERY OLD Basic developer here...)

If there is a definition already in the book, feel free to tell me what page to find it on.

Much appreciated!

gbacklin February 24th, 2013 11:08 PM

Quote:

Originally Posted by RonMcMahon (Post 289543)
I picked up this book yesterday after struggling along with a couple of other authors. Your writing style and comprehensive definitions of what is where and how things work is a perfect match for my learning style.

As you may have expected, I stumbled once I hit Chapter 4 with the missing @synthesize instructions. I haven't found any reference to @synthesize in the index either, so perhaps coverage of this is completely missing from the book(?)

If this is so, could you be so kind as to post a definition and description of @synthesize in the same style as is used in the book so that I can wrap my mind around the how and why of @synthesize? (VERY OLD Basic developer here...)

If there is a definition already in the book, feel free to tell me what page to find it on.

Much appreciated!

Hi Ron,

in the old days (like in the NeXTSTEP days) when you declared a variable in the interface (.h) file, you would manually code your setter and getters.

When this book was written you would type:
@property (strong, nonatomic) NSString *value;

in the interface (.h) file and then in the implementation (.m) file you would type:

@synthesize value;

This would automatically give you setters and getters:

[self setValue@"some string"];

NSString *myValue = [self value];

Thus you would not have to write the setters and getters if you used @property/@synthesize

In the latest Xcode and iOS 6.x you no longer have to include the @synthesize anymore if you use the @property.

Is that as clear as mud ?

[:)]

RonMcMahon February 25th, 2013 02:46 AM

A muddy hole...
 
First let me thank you for your very fast response and fairly good explanation. I'm still wrapping my mind around the set and get structure, adjusting it from my use of it in VB6 (yeah, I'm ancient).

Where you lost me is your assertion that @synthesize is no longer necessary if I use @property, which would mean that the code in the book by 'missing' the @synthesize portion is just fine because it still directs readers to use @property (My assumption.)

If this is true, then there is some setting on my Mac that I'm missing because my copy of xCode is saying that it is Version 4.6 (4H127). The iPhone simulator says that it is the iPhone 6.1 Simulator, yet if I remove the line @synthesize textLabel; command from the .m file I get an error saying "Use of undeclared identifier 'textLabel'; did you mean '_textLabel'?" and the system offers to 'fix' it (but the fix doesn't result in a functioning app.)

The only thing that I can think may have to do with this is that your response quotes:

@property (strong, nonatomic) NSString *value;

But the code in the video and book use a weak not strong storage value...

gbacklin February 25th, 2013 05:56 AM

Quote:

Originally Posted by RonMcMahon (Post 289547)
First let me thank you for your very fast response and fairly good explanation. I'm still wrapping my mind around the set and get structure, adjusting it from my use of it in VB6 (yeah, I'm ancient).

Where you lost me is your assertion that @synthesize is no longer necessary if I use @property, which would mean that the code in the book by 'missing' the @synthesize portion is just fine because it still directs readers to use @property (My assumption.)

If this is true, then there is some setting on my Mac that I'm missing because my copy of xCode is saying that it is Version 4.6 (4H127). The iPhone simulator says that it is the iPhone 6.1 Simulator, yet if I remove the line @synthesize textLabel; command from the .m file I get an error saying "Use of undeclared identifier 'textLabel'; did you mean '_textLabel'?" and the system offers to 'fix' it (but the fix doesn't result in a functioning app.)

The only thing that I can think may have to do with this is that your response quotes:

@property (strong, nonatomic) NSString *value;

But the code in the video and book use a weak not strong storage value...

Ok, now I think I see what is going on and is directly related to the newer version of Xcode and iOS 6.

Pre iOS 6 you could say:

textLabel.text = @"some text";

after declaring @property/@synthesize the variable (my use of strong was just an example, and not related to your issue)

But pre iOS 6 saying textLabel.text you were directly accessing that variable, but now with iOS 6 by default the @synthesize is defined as:

@synthesize (textLabel=_textLabel);

So your line textLabel.text = @"some text"; would preferably be

self.textLabel.text = @"some text";

or _textLabel.text = @"some text";

The subject of setters and getters also a long time ago were called modifiers and accessors :)

It was practice for some to directly access a declared instance variable for an object. Some used it and others advised against it, suggesting to use methods instead to either assign or retrieve the values for that variable. This then led to the use of setters and getters.

This also then was suggested to use the self (or this, if you came from a java background) declaration to further refine the use of method access/modify with the variable's value.

Visual Basic programmers I knew at the time just simply directly accessed the declared variables, thus had no need to use any methods to access or modify any declared variables, as developers of regular BASIC back in the A$ days !

So my suggestion if you used @property/@synthesize which establishes the set/get methods for your value interaction, I would also then suggest use:

this to precede the variable to use the set/get structure as I this.textLabel.text = @"some text";

Does that help any ?


All times are GMT -4. The time now is 07:22 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.