Appendix A. Exercise Solutions

This appendix gives some tips, hints, and answers to the exercises found at the end of each chapter.

  1. Open a Finder window, and navigate to the /Developer/Applications folder. Drag the Project Builder and Interface Builder icons to your Dock.

  2. Open a Finder window and navigate to the /Developer/Documentation/Cocoa folder. Drag the CocoaTopics.html file to your Dock.

  1. One way to access the documentation:

    Open the /Developer/Documentation/Cocoa/CocoaTopics.html file in your web browser of choice, click on the Foundation link in the Objective-C Framework Reference section, and then follow the NSObject and NSString links.

  2. One way to find the documentation:

    In the Foundation reference document that the NSObject and NSString links are on, go to the bottom of the page, and click on the Functions link. You’ll find the NSLog documentation on this page.

    Tip

    Use the Find functionality of your browser (Edit Find, or

    image with no caption

    -F on most browsers) to search for the NSLog documentation on this rather large page.

  3. One way to do it is to add the following line to the initWithName:artist: method of the Song class:

    NSLog(@"isa: %@ self %@", isa, self);

    This will print the name of the class as well as the description.

  1. Here’s one way to do it:

    Open the strings project we created, and place a breakpoint before the [artist release] statement. Debug the application, ...

Get Learning Cocoa with Objective-C, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.