3.6. Online Documentation

Xcode provides a ton of documentation within easy reach. This includes API documentation for various system frameworks, conceptual documentation that illustrates how various services should be used, and Darwin's man page system. In the following Try It Out example, you learn how to use the documentation tools in Xcode to access the online Cocoa documentation. The techniques illustrated here apply to other online documentation, such as Carbon, QuickTime, and so on.

3.6.1. Try It Out: Searching the Online Documentation
  1. Create a new Foundation Tool project named Greetings.

  2. Open Greetings.m. A source editor window appears.

  3. Replace the contents of main.m with the following code:

    #import <Foundation/Foundation.h>
    int main (int argc, const char *argv[])
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        NSString *user = NSFullUserName;
        NSString *time = nil; // get the current time ...
        printf("Hello %s,\n", [user UTF8String]);
        printf("It is now %s.\n", [time UTF8String]);
        [pool release];
        return 0;

    Notice you haven't actually initialized the time variable to something useful. You need to find some kind of function or method call that returns the current time.

  4. Choose HelpDocumentation. A new window appears titled Reference Library - Developer Documentation, as shown in Figure 3-23. The window is composed of a main toolbar at the top, a Search ...

Get Beginning Mac OS® X Programming 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.