Errata

Learning Carbon

Errata for Learning Carbon

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
Printed Page x
last paragraph

The code samples referenced for download are incomplete.

The file moon.rsrc contains no data i.e their is no image when moon.rsrc is
added to the project and the main.nib file is opened in InterfaceBuilder AND
the project fails to cimpile with a (-39) ResMerge error if moon.rsrc is in
the project.

Anonymous   
Printed Page Page 128
Adding a Text Field

It's not perfectly clear from the text nor from the Figures that
you're adding a text control field instead of a Static Text field.
Since the field is not meant to be edited, I assumed the Static Text
field type.

Anonymous   
Printed Page Page 130
Add a text key and text to the file

There's a serious omission: The text <key, item> pair description
must end with a semicolon.
Example:
{ "Facts" = "The moon is not made of green cheese"; }

This bug took quite a while to find.
I'm using OS 10.2 and got the following error messgage:

2002-08-31 13:10:31.757 Moon Travel Planner[1012] CFLog (0):
CFPropertyListCreateFromXMLData(): Old-style plist parser: missing
semicolon in dictionary.
2002-08-31 13:10:31.781 Moon Travel Planner[1012] CFLog (0):
CFPropertyListCreateFromXMLData(): The file name for this data might
be (or it might not): file://localhost/usr/share/zoneinfo/US/Pacific

Is this an old omission or a change brought about by OS 10.2?
There is no semicolon in the example file "Localizable.strings"
that I downloaded from your website the other day.

Anonymous   
Printed Page EXAMPLES
On line Examples for Chapters 11 and 12

The WEB based examples for Chapters 11 and 12 will not compile because of an error:
Linking /USERS/dietrich/.......etc

can't open /Network/Servers/riemann/homes/aragon/laden/OReilly/Folder/Chapter11
... or something like that. Last Chapter 13 works, so one can use it to check the
operations and code.

Anonymous   
Printed Page 35-36
Example 3-1 and Figure 3-4

This is a typical 'goto' gotcha. If the first require_noerr fails the code
is OK. However, if any of the others fails, you still want to clean up by
calling DisposeNibReference. I changed to code to be the following to fix
this error:

int main (int argc, char* argv[])
{
IBNibRef nibRef;
WindowRef window;

OSStatus err;

// Create a Nib reference passing the name of the nib file (without
the .nib extension)
// CreateNibReference only searches into the application bundle.
err = CreateNibReference (CFSTR("main"), &nibRef);
require_noerr (err, CantGetNibRef);

// Once the nib reference is created, set the menubar. "MainMenu" is
the nameof the menu bar
// object. This name is set in InterfaceBuilder when the Nib is
created.
err = SetMenuBarFromNib(nibRef, CFSTR("MainMenu"));
require_noerr (err, CantSetMenuBar);

// Then create a window. "MainWindow" is the name of the window
object. This name is set in
// InterfaceBuilder when the nib is created.
err = CreateWindowFromNib (nibRef, CFSTR("MainWindow"), &window);
require_noerr (err, CantCreateWindow );

// We don't need the nib reference anymore.
DisposeNibReference(nibRef);

// The window was created hidden, so show it.
ShowWindow (window);

// Call the event loop
RunApplicationEventLoop();

goto EveryThingOK:

CantCreateWindow:
CantSetMenuBar:

DisposeNibReference(nibRef);

CantGetNibRef:
EveryThingOK:
return err;
}

Anonymous   
Printed Page 46

its says, after first building the new project, the application should run
without modification. The first time, when I entered the
words: Moon Travel Planner, with spaces as indicated in the book,
the build failed. I deleted the project and
started over. After I took the spaces out and named the Project
MoonTravelPlanner, without the spaces, the application built and ran
successfully.

Anonymous   
Printed Page 46
2nd Paragraph

Building a skeletal application. Upon using the Dec. 2002 Dev. Tools
(I dont know if the tools are the problem), When choosing the options
that are told to be selected and I press build i get the following:

Building target "Moon Travel Planner" with build style "Development"
(optimization:level '0', debug-symbols:on) - (3 errors)
Missing file or directory: Moon
Missing file or directory: Travel
Missing file or directory: Planner_Prefix.h

This is classified as a a series mistake because I have not been able
to use this book that I have purchased because the program wont let me
continue.

Anonymous   
Printed Page 47
Supplemental Section

'A shortcut is to press Shift-R ....'

Should read

'A shortcut is to press Command-R ....'

Anonymous   
Printed Page 47
Before "Recap"

The behaviour of XCode has changed, so that before we add the PICT resource to the
project (on page 71) we need to add a "New Build ResourceManager Resources Build
Phase" using the "Project Menu" -> "New Build Phase". A convenient place to do this
is while setting up the project on page 47.

If you don't do this, you get no errors, but the PICT resource will not display.
A more detailed description may be found here:
http://www.carbondev.com/site/?page=Interface+Builder+Images

Anonymous   
Printed Page 76
Entire section "5.2.4 Add a PICT Resource"

Apple has done some changes it's developer software. There's two extra steps to add a resource file. This applies at least to Xcode 2.5 on Mac OS X 5.4.

6. Add a Build Resource Manager Resources build phase to your target.
7. Add your resource files to the Build Resource Manager Resources build phase.

Then it will work and the image will show up.

Anonymous   
Printed Page 82
item 3 in "Check the Interface"

I've followed this example, used your example unmodified and it simply does NOT run the interface in Interface Builder using the 10.1 developer tools.

This occurs ONLY after adding the PICT resource.
Prior to adding the resource Interface Builder will run the interface in test mode, but after adding the pict resource it does not.

Anonymous   
Printed Page 88
1st paragraph under Event References

instead of GetEventClass, the word was Get EventClass

Anonymous   
PDF Page 98
Entire section "5.2.4 Add a PICT Resource"

Apple has done some changes it's developer software. There's two extra steps to add a resource file. This applies at least to Xcode 2.5 on Mac OS X 5.4.

6. Add a Build Resource Manager Resources build phase to your target.
7. Add your resource files to the Build Resource Manager Resources build phase.

Then it will work and the image will show up.

Anonymous  Jul 10, 2008 
Printed Page 128
Third paragraph in numbered list

Reads:
"...130 in the ID field."

Should read:
"...131 in the ID field."

Anonymous   
Printed Page 128
last paragraph

last number in line 3 should be 131

James Pengra  Nov 01, 2009 
Printed Page 138
Throughout the chapter

After going through Chapter 9: Printing, the Page Setup and Print dialogs don't
work when compiled with Project Builder 1.1.1 and run on Mac OS X 10.1.2. The
examples when downloaded directly from the official site have the same problem.

Anonymous   
Printed Page 155
Last paragraph

The last sentence on page 155 says to copy the code shown in Example 9-1 to
the main.c file, below the MTPAboutWindowCommandHandler function. The
writing of the AboutWindow command handler function does not occur until
page 193.

Anonymous   
Printed Page 173
end of page

there are two } at the bottom of page 178, and the code continues on the following page with "tempErr=" however, three } are requir
ed to close the print job code block.

bottom of page 173 should read:
pageNumber++; // 17
}
}
}

Anonymous   
Printed Page 192
1st Paragraph

'Enter MTTP as the static...'

should read

'Enter MTPP as the static...'

Also later in the same paragraph MTTP is used in place of MTPP for a second
time.

Anonymous   
Printed Page 192
1st Paragraph-- item #20

This paragraph should include (for completeness) an instruction to increase the size
Static Text Info box, otherwise when it displays, only the part of the text that it
can contain will appear, giving the impression of a program bug.

Anonymous   
Printed Page 227
4th program line

The line reads HICommandcommand;
It should read HICommand command;

Anonymous   
Printed Page 246
Example 11-12

When saving an itinerary and reopening it with the Moon Travel Planner application,
the file is only half the length it should be.

The call to FSWriteFork (commented //7) on p246 is the cause of this bug:

'length' is initialised with the number of UniCode characters in 'theString'.
'buffer' is a pointer to a buffer of length*2, as UniCode characters each require two
bytes of storage, so the buffer is big enough to store the whole text.

The call to CFStringGetCharacters copies all the text into 'buffer', as the 'length'
field here is a character counter.

The call to FSWriteFork uses length as a byte count, when in fact it's a UniCode
character count; changing the line to read:

err = FSWriteFork(forkRefNum, fsFromStart, 0, length * sizeof(UniChar), (void *)
buffer, NULL);

fixes the problem.

Anonymous   
Printed Page 304
Example 14-6

Multiple errors: Compilation type.....

1) TAB_SIGNATURE must be defined as: #define TAB_SIGNATURE 'MTPP';
in the global #define definitions

2) The definition < WindowRef MyWindow; > must be placed in the global definition
region in main. At the same time in main, the precoded references to a window must
be changed to MyWindow otherwise the compilation will fail upon unsatisfied
reference.

3) in main, added to the definitions at the start of main in Example 14-6, one must
add ControlRef tabControl;

4) The line of 14-6 eventTypeSpec =... for which an verified error is admitted is in
additionally incorrect because it should start EventTypeSpec =. There is no typedef
eventTypeSpec.

5) The EventTypeSpec = .. line needs to be moved up before the
controlID.signature=TAB_SIGNATURE declaration, otherwise a large number of not very
meaningful compiler errors are generated.

Operation Errors:
After the preceding changes are made, the program still does not work properly though
it compiles. I added to the Travel Time pane the nib file material for the Moon
Travel Planner, but did not add the code for Moon Travel Panner. Though I did not do
it, the size of the main window needs to be increased, so that the pane is big enough
to hold the Moon Travel Planner. When executed, the two tab window comes up with the
MoonTravelPane on top, as desired, and the pressing the present pane's tab does
nothing (as desired), while pressing the other tab switches the foremost pane (again
as desired). BUT... there are two problems

1) When the view is switched to the Itinerary pane, the Compute Travel Time button
remains in view. This can be eliminated if this button is desginated as an ordinary
button, not the pulsing target in the nib file specifications.

2) When one attempts to switch back from the Itinerary tab to the Travel Time tab,
none of the Travel Time graphic items appear-- the pane is blank. When trying to
switch from tab to another, while the tab is held down (ie the mouse button is held
down with the cursor over the tab), the Moon Travel graphics are totally visible, but
disappear as soon as the mouse is released. This is true no matter which way the
switching goes. There is a serious bug here.

Anonymous