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.
Version |
Location |
Description |
Submitted By |
Date submitted |
Date corrected |
Printed |
Page 1oo
Last block of code, at (3) |
Should "newCity" not be released after having been added to "cities"?
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Anonymous |
Feb 22, 2011 |
|
|
12
5th paragraph |
The text asks the reader to click the link to the "iPhone Developer Program Portal. I believe you want to click the link to the "iPhone Provisioning Portal."
Note from the Author or Editor: Fixed in the second edition. See http://shop.oreilly.com/product/0636920018490.do
See the sidebar on Page 6, Chapter 2, for a full listing of the four main websites involved in the development process. Unfortunately between the book going to press and publication Apple has somewhat changed how it refers to one of these websites involved in iPhone Development. All references in the text to the "Developer Program Portal" should be replaced with the "iPhone Provisioning Portal". The actual content of the site referred to in the text however has not changed.
|
ThreeE |
Mar 28, 2010 |
|
Printed |
Page 36
Last sentence (continues to p. 37) |
This relates to the sentence:
"You should now see a connection between the sayHello received action and the Round Rect Button (Push me!) Touch down event."
As we have just selected the 'Touch Up Inside' event, surely the (emboldened) 'Touch down' is wrong. If for some reason it is right, the 'down' should read 'Down' as that's how it appears in the screen shot in Figure 3-6, and I presume 'Touch Up Inside' would be wrong, as would Figure 3-6, where 'Touch Up Inside' is highlighted.
Incidentally, it would have been helpful to have had a brief explanation of why we select 'Touch Up Inside' as the name conveys no meaning to me.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
David Leader |
Aug 27, 2010 |
|
Printed |
Page 37
top line of page |
text reads "RoundRect Button (Push Me!) Touch down event." when it probably should read "RoundRect Button (Push Me!) Touch Up Inside event."
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Timothy Knox |
Oct 31, 2010 |
|
PDF |
Page 43
2nd paragraph starting from the title "Object Typing" |
The strongly typed declaration written in the book is "UIButton *button;"
While the following line explains that we are declaring the an object called "anObject" from the class "SomeClass".
If so you should change the declaration into "ComeClass *anObject" or you should change the explaination saying that we are declaring an object called "button" from the class "UIButton".
Note from the Author or Editor: Fixed in the second edition. See http://shop.oreilly.com/product/0636920018490.do
The second paragraph of the "Object Typing" section on page 43 should read,
"Here we declare a button object. In the first instance we use strong typing, declaring it as an
object of the class UIButton."
rather than,
"Here we declare anObject. In the first instance we use strong typing, declaring it as an
object of the class SomeClass."
as it currently stands.
|
FrankB |
Apr 30, 2010 |
|
Printed |
Page 60
4th Paragraph, on line 5 of the example code |
Section should read -(Void) instead of (void)
#pragma mark Instance Methods
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
instead it reads
(void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
first line is missing the - charactor
Note from the Author or Editor: Fixed in the second edition.
See: http://shop.oreilly.com/product/0636920018490.do
|
Leon |
Jan 24, 2012 |
|
PDF |
Page 68
2nd code sample |
The text that follows this code mentions that the class City is declared using the @class declaration, though the declaration does not actually appear in the code sample.
Note from the Author or Editor: Fixed in the second edition. See http://shop.oreilly.com/product/0636920018490.do
The paragraph following this code sample (the 1st paragraph on page 69) should read;
"In the application delegate interface file we declare our RootController class using the @class declaration, create an NSMutableArray to hold our list of cities, and declare this mutable array to be a property."
rather than,
"In the application delegate interface file we declare our City class using the @class declaration, create an NSMutableArray to hold our list of cities, and declare this mutable array to be a property."
|
austux |
Apr 27, 2010 |
|
Printed |
Page 69
#import statements |
The line
#import "City.h";
should not have a trailing semicolon
Note from the Author or Editor: Fixed in the second edition. See http://shop.oreilly.com/product/0636920018490.do
There should not be a semi-colon at the end of the import statement.
|
Sean Cassidy |
Jul 06, 2010 |
|
Printed |
Page 69
half way down; code for applicationDidFinishLaunching |
This may be a matter of SDK version. I'm running XCode 3.2.3 and Simulator 4.0. But notwithstanding...
We are instructed to modify "applicationDidFinishLaunching". However, no such function was created by the template, so I had to create it by hand.
Furthermore, the template DID create a function "application didFinishLaunchingWithOptions" which, until I luckily tried commenting it out, caused the test Build and Run on p. 69, which should result in Figure 5-12, to display only an empty table.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Dave |
Sep 15, 2010 |
|
Printed |
Page 69
code sample |
The code example in the book uses San Francisco, but the samples on the web site, including especially the images, use New York.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Mike Curtin |
Oct 19, 2010 |
|
Other Digital Version |
71.0
Figure 3.1 |
The figure showing the newly created HelloWorld project shows two xib files in the Resources folder. MainWindow.xib and HelloWorldViewController.xib. However, when I create this project xcode generates MainWindow.xib and RootViewController.xib. Why is there a difference?
Also, when I run this new HelloWorld project I get a blank screen with lines rather than a blank gray screen. Have I change a setting somewhere I should not have?
I think both of the above questions are related and that is why I am posting them together.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
troypeterson |
Jan 19, 2011 |
|
Printed |
Page 73
code snippet at bottom of page |
I don't think you should be releasing the "cities" variable. The cities variable here is just pointing to the object, it does not "own" it (it didn't allocate it), so it shouldn't release it. To put it another way, the alloc/release counts do not balance for this object: the original alloc is on p.69, there is a release for it on p.70, and this alloc on p.73 is a second release for the same object.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Anonymous |
Mar 18, 2011 |
|
Printed |
Page 74
last paragraph |
I believe this:
cancelButtonTitle:nil otherButtontitles:@"OK", nil];
shuld be this:
cancelButtonTitle:@"OK" otherButtonTitles:nil];
(found that online somewhere, it seems to work the way one would want it
to work)
I am completely new to this so excuse me if I am getting this all wrong.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Lisa |
Jul 07, 2010 |
|
Printed |
Page 77
2nd paragraph |
//[window addSubview:viewController.view];
navController.viewControllers = [NSArray arrayWithObject:viewController];
[window addSubview:navController.view];
[window makeKeyAndVisible];
code to add viewController to navController doesn't work. code worked before this addition when showing viewController alone but with this addition app shows up black screen and immediately quits. Added nav control in interface builder aand all looks just like fig 5-14 and 5-15, and in cityguideDelegate.h and .m but doesn't show 5-16 when run. help! thanks
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Marsh McJunkin |
Jul 22, 2010 |
|
Printed |
Page 77
4th paragraph from the bottom |
It says:
"Note the navigation bar that appears at the top (with the title "City Guide")."
However, we haven't gotten that far yet :-) Instead it should read:
"Note the navigation bar that appears at the top (with the title "Root View Controller")."
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Dave Kitabjian |
Sep 15, 2010 |
|
Printed |
Page 77
5th paragraph |
The last sentence refers to a navigation bar 'with the title "City Guide"'. In figure 5-14, the navigation bar reads "Root View Controller" (as does the window in Interface Builder on my Mac as I'm following the steps in the book).
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Mike Curtin |
Oct 19, 2010 |
|
PDF |
Page 77
2nd paragraph |
// Override point for customization after app launch
navController.viewControllers = [NSArray arrayWithObject:viewController];
[window addSubview:navController.view];
[window makeKeyAndVisible];
I suppose some things changed in since 4.0. The program created the template with _viewController add-on to the viewController declaration, and uses self.viewController everywhere on the page. The two bottom lines are also wrong now, instead there are :
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
RETURN YES;
so to make things work you gotta write :
self.navController.viewControllers = [NSArray arrayWithObject:self.viewController];
self.window.rootViewController = self.navController;
[self.window makeKeyAndVisible];
RETURN YES;
instead of what's written in the book.
took me a couple of hours to find&understand... hope it helps someone.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Yair Even-Haim |
Jul 30, 2011 |
|
Printed |
Page 82
last code sample on page |
The line
if ( self == [super init] )
should read
if ( self = [super init] )
We want to assign, not test for equality.
Note from the Author or Editor: Fixed in the second edition. See http://shop.oreilly.com/product/0636920018490.do
Confirmed. The init method from the CityController.m class quoted on p82 should read,
- (id)initWithIndexPath: (NSIndexPath *)indexPath {
if ( self = [super init] ) {
index = indexPath;
}
return self;
}
We're overriding the initialisation method of the super class. It?s important to call the [super init] method first to ensure that instance variables up the inheritance hierarchy are initialized in the proper order (from top to bottom). Also, if your initialize code fails, you need to return nil from the overriden init method.
|
Jim Geist |
Apr 04, 2010 |
|
Printed |
Page 83
3rd code sample |
the line
[index release];
causes my app to crash when the cityView is popped.
when I omit this line I have no issues.
I am not a very experienced programmer for anything mac, however I think that releasing this index is causing my view to pop which then crashes my app. Is this correct or am I doing something else wrong?
Thank you,
Derrick
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Derrick Henning |
Oct 12, 2010 |
|
Printed |
Page 84
3rd paragraph |
Figure 5.19 on the page looks like the UIImageView is centered horizontally, which requires either X = 35 (instead of 25), or width = 270 (instead of 250). Since the images are 1000 x 750, a width of 250 (with the height of 188) has the same aspect ratio, so the X = 35 change would be the right one.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Mike Curtin |
Oct 19, 2010 |
|
Printed |
Page 84
3rd paragraph |
I should have mentioned that the Y = 37 should be Y = 35 as well.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Mike Curtin |
Oct 19, 2010 |
|
Printed |
Page 86
Last paragraph |
In the last sentence, "the one line (return cities.count;)" should read "return [cities count];", as that's what we were directed to code in the first example on p. 74.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Mike Curtin |
Oct 20, 2010 |
|
Printed |
Page 87
Second block of code |
Very minor typeface error, but for the next revision of the book note that the line:
cell.textLabel.text = this.cityName;
should NOT be emboldened because, like the line above, it has already been introduced on p. 74.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
David Leader |
Sep 04, 2010 |
|
Printed |
Page 92
1st paragraph |
"So, the only cell in our table view whose row number is greater than the number of entries in the city array is the "Add New City..." cell."
should be
"So, the only cell in our table view whose row number is equal to the number of entries in the city array is the "Add New City..." cell."
Note from the Author or Editor: Fixed in the second edition. See http://shop.oreilly.com/product/0636920018490.do
Agreed. Should be "equal" rather than "greater". See the code on the previous page (page 91).
|
Anonymous |
Apr 27, 2010 |
|
PDF |
Page 94
2nd paragraph |
Since we haven't explicitly allocated memory for our own internal thoughts...
"Yes, in case you didn?t release it, that?s just a highly customized table view."
Should be:
"Yes, in case you didn?t realize it, that?s just a highly customized table view."
(or "realise" in UK English)
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Seth Freach |
Nov 15, 2010 |
|
Printed |
Page 95
lines 2-3 |
"In the Attributes tab you may want to add some placeholder text to the Text field..."
should read
"In the Attributes tab you may want to add some (placeholder) text to the Placeholder field..."
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
David Leader |
Sep 07, 2010 |
|
PDF |
Page 98
next to last paragraph |
While establishing the connections in AddCityController.xib, the description on page 98 covers the necessary steps to connect the following: descriptionCell, nameCell, tableView, dataSource, and delegate outlets. However, Figure 5-26 (on page 99) also shows that 'view' is connected to 'View', yet the text does not mention it. Is it implied, or should it have been mentioned in the text?
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
John Leko |
Mar 29, 2011 |
|
Printed |
Page 100
Section: Capturing City Data |
This is a question about the effect of ios4 and the upgrade to XCode on the examples in the book, specifically the above section, which I have followed but cannot manage to save the City data. (Code before this has worked fine in Ch 5).
I've checked the code I typed against the downloaded sample (and copied and pasted it in) without success. I can't actually run the sample for Ch 5 as I get the build error: "There is no SDK with the name or pathe iphoneos3.0."
I appreciate that it is a bit wimpish to post that you can't get something to work, and I also appreciate that it will be a huge chore to revise the book for the latest os upgrade, but there are clearly differences in the boiler plate code that the latest version of Xcode generates and I wonder whether the upgrade is causing this and potentially other problems.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
David Leader |
Sep 07, 2010 |
|
Printed, |
Page 120
Second paragraph |
The second paragraph on p. 120 states, "[The first view controller] has no linked NIB file". In Xcode 3.2.6, the automatically generated FirstView.XIB is linked there.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Philip Garofalo |
Jun 21, 2011 |
|
Printed, |
Page 121
First paragraph, 6th paragraph |
This section of the text is the beginning of the Tab Bar Applications example. The first line in the first paragraph is, "In Xcode, create a new ViewNIB called FirstView.xib." Well, this NIB is already created by the Xcode template. The text is written as though this file doesn't already exist.
There are two errors in the sixth paragraph. The MainWindow.xib Interface Builder entry is "View Controller (Second)" or "Selected View Controller (Second)", not "Second View Controller (Second)". The same paragraph also states, "You don't need to connect the view outlet...because Xcode created the second tab bar item with its outlets connected correctly by default." This is not true, at least in Xcode version 3.2.6.
In fact, the best way to proceed with this example is to ignore p.121 (the "Refactoring the Template" section) entirely.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Philip Garofalo |
Jun 21, 2011 |
|
Printed |
Page 137
Figure 3-18 |
The caption for Figure 6-18 refers to "Connecting the addCity: received action", while the figure itself shows connecting the addPicture: received action.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Mike Curtin |
Oct 21, 2010 |
|
Printed |
Page 140
1st block of code |
pickerController.allowsImageEditing = NO;
allowsImageEditing - is deprecated in the latest SDK. [Xcode: 4.0.2]
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Alex Hedley |
May 27, 2011 |
|
PDF |
Page 148
applicationDidFinishLaunching |
In Xcode, Build and Analyze reports a potential memory leak for Reachability *reach. Should there be some release code somewhere?
Note from the Author or Editor: Fixed in the second edition. See http://shop.oreilly.com/product/0636920018490.do
Yes there should. The Reachability object reach is explicitly retained,
Reachability *reach = [[Reachability reachabilityForInternetConnection] retain];
and thus should be released. The easiest place to do this is after releasing the UIAlertView object. So the the applicationDidFinishLaunching: method should read,
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:viewController.view];
[window makeKeyAndVisible];
Reachability *reach = [[Reachability reachabilityForInternetConnection] retain];
NetworkStatus status = [reach currentReachabilityStatus];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Reachability"
message:[self stringFromStatus: status]
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
[reach release];
}
|
John Ure |
Jun 20, 2010 |
|
PDF |
Page 175
Current Conditions (4) |
The icon instance variable is defined as a UIImage in the code:
// Current Conditions
UIImage *icon;
NSString *temp;
NSString *humidity;
NSString *wind;
NSString *condition;
whereas it is actually an NSString and not converted into an icon in the forecast. The code should be:
// Current Conditions
NSString *icon;
NSString *temp;
NSString *humidity;
NSString *wind;
NSString *condition;
This will impact a few further parts such as the @property definition for icon (to an NSString).
The reason the code works despite the incorrect type being displayed is that where it is used in Forecast.m:
icon = [NSString stringWithFormat:@"http://www.google.com%@", [node objectForKey:key]];
The stringWithFormat method returns an id, so breaks the type safety.
Then when the icon is used in MainViewController there has always been a cast (which should have been unnecessary!):
NSURL *url = [NSURL URLWithString:(NSString *)forecast.iconPath];
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Daniel Harman |
Jul 29, 2010 |
|
PDF |
Page 178
|
The NSURLConnection object is leaking in the example as it is not being released in connectionDidFinishLoading and didFailWithError, but it was instantiated with an alloc so reference count is +1 and needs to be released.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Daniel Harman |
Aug 02, 2010 |
|
|
180
3rd paragraph |
This section:
Then make the change shown in bold to the top of MainViewController.h:
#import "MainViewController.h"
#import "MainView.h"
@implementation MainViewController
@synthesize forecast;
I can only get this to compile when I make these changes to the MainViewController.m file and not the .h file. Its also importing the .h file so i'm pretty sure that this needs to go into the .m file.
Note from the Author or Editor: Fixed in the second edition. See http://shop.oreilly.com/product/0636920018490.do
Confirmed as a typo. The line about 1/2 way day page 180 reading, "Then make the change shown in bold to the top of MainViewController.h" should read "Then make the change shown in bold to the top of MainViewController.m".
|
Josh Bright |
Apr 11, 2010 |
|
Printed |
Page 180
Final code snippet on p180 |
In the final code snippet on p180, which spans to p181, implementing the dealloc: method for the Weather application the code should read:
- (void)dealloc {
[loadingActivityIndicator release];
[nameLabel release];
[dateLabel release];
[nowImage release];
[nowTempLabel release];
[nowHumidityLabel release];
[nowWindLabel release];
[nowConditionLabel release];
[dayOneLabel release];
[dayOneImage release];
[dayOneTempLabel release];
[dayOneChanceLabel release];
[dayTwoLabel release];
[dayTwoImage release];
[dayTwoTempLabel release];
[dayTwoChanceLabel release];
[dayThreeLabel release];
[dayThreeImage release];
[dayThreeTempLabel release];
[dayThreeChanceLabel release];
[dayFourLabel release];
[dayFourImage release];
[dayFourTempLabel release];
[dayFourChanceLabel release];
[refreshButton release];
[forecast release];
[super dealloc];
}
instead of,
- (void)dealloc {
[loadingActivityIndicator dealloc];
[nameLabel dealloc];
[dateLabel dealloc];
[nowImage dealloc];
[nowTempLabel dealloc];
[nowHumidityLabel dealloc];
[nowWindLabel dealloc];
[nowConditionLabel dealloc];
[dayOneLabel dealloc];
[dayOneImage dealloc];
[dayOneTempLabel dealloc];
[dayOneChanceLabel dealloc];
[dayTwoLabel dealloc];
[dayTwoImage dealloc];
[dayTwoTempLabel dealloc];
[dayTwoChanceLabel dealloc];
[dayThreeLabel dealloc];
[dayThreeImage dealloc];
[dayThreeTempLabel dealloc];
[dayThreeChanceLabel dealloc];
[dayFourLabel dealloc];
[dayFourImage dealloc];
[dayFourTempLabel dealloc];
[dayFourChanceLabel dealloc];
[refreshButton dealloc];
[forecast dealloc];
[super dealloc];
}
substituting the calls to the dealloc: method for each of the instance variables with calls to the release: method.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
|
May 14, 2010 |
|
Printed |
Page 182
Sidebar |
The XPath wrappers are no longer located at:
http://cocoawithlove.googlepages.com/XPathQuery.zip
and can now be found at:
http://projectswithlove.com/projects/XPathQuery.zip
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
|
Mar 01, 2011 |
|
Printed |
Page 194
last code snippet |
To be conform to best practices of the "Event Handling Guide" (http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009541 ; page 30),
the class CustomView which is a subclass of UIView must not call the nextResponder method and it must implement the methods touchesBegan, touchesMoved and touchesCancelled (a null implementation)
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Laurent Delbecque |
Jun 04, 2011 |
|
Printed |
Page 204
2nd code snippet |
The search URL
http://search.twitter.com/trends.json
produces
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
It has been moved to
http://api.twitter.com/trends.json
and returns:
{"trends":[{"url":"http:\/\/search.twitter.com\/search?q=%23youdumbashell","name":"#youdumbashell"}, ... ,"as_of":"Sat, 11 Jun 2011 10:40:38 +0000"}
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Alex Hedley |
Jun 11, 2011 |
|
Printed |
Page 208
The dealloc: method 1/2 way down the page |
The dealloc: method in the code example in the middle of the page should read,
- (void)dealloc {
[names release];
[urls release];
[super dealloc];
}
rather than,
- (void)dealloc {
[names dealloc];
[urls dealloc];
[super dealloc];
}
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
|
May 14, 2010 |
|
Printed |
Page 221
1st code sample on that page |
In the copyDatabaseToDocuments: method the filePath variable needs to be retained before it is returned. The following line should be added,
[filePath retain];
after the line,
NSString *filePath = [documentsPath stringByAppendingPathComponent:@"cities.sqlite"];
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
|
Apr 26, 2010 |
|
Printed |
Page 221
2nd code sample on that page |
The NSData variable is not correctly released in the readCitiesFromDatabaseWithPath: method . Add the line,
[cityData release];
after the lines
NSData *cityData = [[NSData alloc] initWithBytes:sqlite3_column_blob(compiledStatement, 3) length: sqlite3_column_bytes(compiledStatement, 3)];
UIImage *cityImage = [UIImage imageWithData:cityData];
to rectify this problem.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
|
Apr 26, 2010 |
|
|
279/590
in the code of @impementaiton WeatherForecast |
The following line in the definition of - (void)queryService:(NSString *)city was a problem for me.
----
NSString *url = [NSString [stringWithFormat:@"http://www.google.com/ig/api?weather=%@",city];
----
The response from google.com or google.co.jp was in Japanese with Shift-JIS encoding and < connectionDidFinishLoading: >didn't work. So I changed the format string into the following:
---
@"http://www.google.com/ig/api?weather=%@&oe=UTF-8"
---
This worked all right. I hope this information will hellp Japanese readers.
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
AKIMATSU |
Oct 04, 2011 |
|
Printed |
Page 302
example at top of page |
first, initialize is missing some lines of text between
NSMutableDictionary *defaultsToRegister = ...
and
[defaults registerDefaults:defaultsToRegister];
the missing lines are:
for (NSDictionary *defaultSetting in preferences) {
NSString *key = [defaultSetting valueForKey:kPreferenceKeyKey];
NSString *value = [defaultSetting valueForKey:kPreferenceDefValueKey];
if ((key != nil) && (value != nil)) {
[defaultsToRegister setValue:value forKey:key];
}
}
second, at the very top of the function, after assigning the singleton to NSUserDefaults *defaults, a check should be made to see if defaults is empty. if there was a string value in the defaults, e.g., "kFirstNameKey", the test could be this:
if ([defaults stringForKey:kFirstNameKey] != nil) {
return;
}
Note from the Author or Editor: Fixed in the second edition.
See http://shop.oreilly.com/product/0636920018490.do
|
Marshall Rose |
Jul 07, 2010 |
|