Learning Cocoa By Apple Computer, Inc. Unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. This page was updated October 10, 2003. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification UNCONFIRMED errors and comments from readers: (39) 2nd code sample; -initArg:(in0t)tag arg:(struct info *)data; should be -initArg:(int)tag arg:(struct info *)data; [62] first code sampleat top of page: The code as written in the book: keyArray = [myDict allKeys]; for (index = 0; index < [keyArray count]; index++) NSLog(@"Dictionary key at index %i is %@.\n", index, [keyArray objectAtIndex: index]); Earlier in the code I have keyArray typed as: NSMutableArray *keyArray; and allocated and initialized as: keyArray = [[NSMutableArray alloc] init]; When I build the project, I get the following warning: assignment from incompatible pointer type this applies to the line: keyArray = [myDict allKeys]; When I run the program, I get the proper results, but get the following when terminating: Hello World has exited due to signal 11 (SIGSEGV). Have I done something wrong, or is there a problem or omission in the book. (I have found that the book assumes you know how and where to type and initialize new variables. For a beginner this is a challenge.) [62] 1st paragraph; In the block of literal text to be entered for the bullet item "Add several different key-value pairs to the dictionary..." the word "index" is used as the loop variable everywhere but within the "NSLog" statement , where it is referenced as "i" (look for "%i") [71] Item #2; The NSObject is only available when the application is a Cocoa Java application, not a plain Cocoa application. Without further exp loration this renders the rest of the chapter unusable. [73] First paragraph: Proj builder 1.0.1 build ver 63 I cannot drag the MyController instance to the text field nothing happens.Figure 6-14 page 74 is incorrect. Same for page 87 figure 6-26. I consider my self a compotent Unix programmer but this ones got me beat please help. {85} Right above the diagram; "1. Click Actions under myConverter in the Class pane .." should read: "1. Click Actions under myController in the Class pane .." {90} item 6; Command-R does not debug the program - it runs it. Command Y debugs (as of December 2001 PB). [101] Project Indexing; There does not appear to be any support for Project Indexing in Project Builder 1.1.1 (December 2001 release) in the manner described in this section (Command-Option-I or via Project Menu). Unable to continue in this section of the book. [101] P.I., 3rd Paragraph; Project Builder 1.1.1 automatically indexes projects with out any intervention of the user. This feature can be turned off in the Info window after selecting the project in "Groups and Files" on "Files" tab of P.B. You can also rebuild the index at anytime if you suspect corruption. See Project Builder Help for more info. [121] Implement Currency Converter's Classes: 2. Insert Code for convert Amount: Code snipet; convertAmount is declared as an instance method. However the Converter class does not have constructor, so could convertAmount be used as an instance method? In the following page (122), convertAmout is used with the instance "convert", but its not declared. To make it work: 1. Should'nt convertAmount be delcared as a class method? + (float) convertAmount: (float) amt atRate: (float) rate; 2. Should be used as: total = [Converter convertAmount: amout atRate : rate]; {137} 7th paragraph including code samples; setRadius method implementation has a (void) return, and I think it should be an (IBAction) return. Otherwise the DotView does not update when radius or color are changed. Note that the same problem arises on the next page with setColor. [148] awakeFromNib code listing; I believe that: - (id) awakeFromNib should be: - (void) awakeFromNib {149} 3rd paragraph; "Because MyController registers itself as an observer in its init method, ..." Actually, the registration occurs in its "awakeFromNib:" method on the previous page. (161) Item 5: The line "- (NSArray *)expenses {" should read "-(NSMutableArray *)expenses {" so that the implementation matches the declaration made in item 2. [162] Step 4; Step 4 requires the student to "Open My Data Source.m and import Expense.h," but this indicates that this text is added to My Data Source.m when in fact it should be added to My Data Source.h. [164] middle step in generateTestData method; as printed, the line reads: (NSDecimalNumber *) [NSDecimalNumber numberWithInt:index]]; The completed examples downloaded from this site read ( for the same line): [NSDecimalNumber numberWithInt:index]]; This doesn't seem necessary. (175) 2nd paragraph; In the first sentence of the section "Get Started," the word "them" is repeated: ....you've encountered them them in Chapter 7... {186} Half way down: The example requires the file "airplane.tiff", but I can't find it anywhere. I searched my entire hard drive, and it's not there. {250} Figure 12-6; In the outlets of the Calendar Matrix subclass, "prevMonthButton" is omitted. {206} example 10-6 implementation of extractFields: method; The last line of the implementation of the extractFields: method is: [aRec setComments:[commentsField string]]; the problem with this is [commentsField string] returns a mutable string that is retained by the commentsField. Instead something like: [aRec setComments:[[commentsField string]copy]]; should be used {207} Last paragraph; In the sentence: "The object returned by the expression [aRecname] is used..." [aRecname] should have a space in it reading [aRec n ame] as it appears in Example 10-7. (217) Top of page, 4th line: An extra ']' in included at the end of the line: [coder encodeObject:[self name]]]; should read [coder encodeObject:[self name]]; {234} last paragraph of chapter 11; The RTF Editor application that is described in chapter 11 to demonstrate multiple document architecture does not print its documents. I'm using Interface Builder that shipped with OS 10.2 developer tools. The fix for this is to open the MainMenu.nib and select the File->Print item from your menu. Use the Inspector to examine the connections. You'll notice that the Print target is connected to the printDocument: method. Disconnect that and change it to the print: method. I guess NSTextView objects don't respond to printDocument. {245} In the last paragraph: "The iniWithName: method simply..." should be: "The initWithName: method simply..."ement of the reported error is requested. (252) In Table 12-2; Inside the table listing, "prevMonthButton" should be: "lastMonthButton" (252) first paragraph; "... Luucida Grande 18 points..." should be: x "... Lucida Grande 18 points..." {256} 6th paragraph; Text leaves the implementation of dealloc for CalendarMatrix to the user but the example code for download omits the call to: [super dealloc] at the end of the function so the cells in the matrix never get deallocated. (257) first code example in "Implement refreshCalendar"; The second line of code ("containing ... each month") should probably begin with a comment or the first and second lines should be placed in a comment block ("/* ... */") [259] Example 12-7, last section; The unsuitable last three lines will select the current day (Today) quite independent of any other selections that may be current. With the published code, in the current month, both the 1st and the current day will be selected after some juggling between the months. The solution is to replace these lines with the much simpler code used in the refreshCalendar method that will automatically select a new cell and deselect any other selection. [self selectCellWithTag:([now dayOfMonth] + startOffset - 1)]; {259} Contents of the "if" block in Example 12-7; The intent of the code (as described on page 259 and from the name of the highlightTodayIfVisible) seems to be to highlight the cur rent day if it is visible without regard to the current selection. If so neither the code in the book nor the suggested change alr eady submitted seem right but rather the third line of the conditional should be omitted: if(([selDate yearOfCommonEra] == [now yearOfCommonEra]) && ([selDate monthOfYear] == [now monthOfYear])) { aCell = [self cellWithTag:([now dayOfMonth] + startOffset - 1)]; [aCell setHighlightsBy:NSMomentaryChangeButton]; [aCell setCellAttribute:NSCellHighlighted to:YES]; } [260] Example 12-8, 4th section; The line [self highlightTodayIfVisible]; should be removed as it prevents the selection of other dates in the current month. This error is connected with one in the actual code for highlightTodayIfVisible on page 259. {262} example 12-10; The following declaration needs to be added to the ToDoDocument class: NSData *dataFromFile; [266] Paragraph immediately after Example 12-13; The text states with reference to Example 12-13 "Finally the method makes the document window key and orders it frontmost." No it doesn't; no such code is contained in Example 12-13. The last thing it does is initializes the internal data model. {270} 12th line of Example 12-18; prevNameAtIndex = [[currentItems objectAtIndex:row] name]; should be: prevNameAtIndex = [[currentItems objectAtIndex:row] itemName];{270} 12th line of Example 12-18; prevNameAtIndex = [[currentItems objectAtIndex:row] name]; should be: prevNameAtIndex = [[currentItems objectAtIndex:row] itemName];{270} 12th line of Example 12-18; prevNameAtIndex = [[currentItems objectAtIndex:row] name]; should be: prevNameAtIndex = [[currentItems objectAtIndex:row] itemName];{270} 12th line of Example 12-18; prevNameAtIndex = [[currentItems objectAtIndex:row] name]; should be: prevNameAtIndex = [[currentItems objectAtIndex:row] itemName]; (282) 2nd paragraph; "InfoWindowController.m" Should be: "InfoWindowController.h" (287) beginning of Example 13-4; "- (void),pdateInfoWindow" should be: "- (void)updateInfoWindow" [292] omission textDidChange( with TextDidEndEditing); example has the follow however the book does not. you do not save the notes without this code. ------- // did not find this in book - (void)textDidChange:(NSNotification *)notification { if ([notification object] == infoNotes) { [[_inspectingDocument selectedItem] setNotes: [infoNotes string]]; [_inspectingDocument selectedItemModified]; } } // same code as textDidEndEditing maybe a misname. // rich van deren vanderen@pacbell.net [295] After the section "Reassign the Class of the itemList Matrix"; After reassigning the class of the "itemList" matrix to the newly created class "SelectionNotifyMatrix" in Interface Builder, the book fails to mention that you need to also reassign the class of the "statusList" matrix to "SelectionNotifyMatrix" in order for the application to work. This is done in the example code available for download from your web site, however is not mentioned in the book. {333} section 12: In section 12, in the implementation of the drawrect: method the last line should read: NSMakePoint((myBounds.size.width/4.0),5) withAttributes: attrs]; instead of: NSMakePoint((myBounds size.width/4.0),5) withAttributes: attrs]; with this change the example won't compile.