1/24/2010

Cocoa Maker 1 - Getting Started

James (MrGeckosMedia.com), joined by, Eduardo (MegaEduX.com), Nick, and Karl, teaches the basics of installing Xcode, setting up a project and making a "Hello, World!" command line utility.

30:16
Example code from episode.
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSString *name = @"World";
    if (argc>1) {
        name = [[[NSString alloc] initWithBytes:argv[1] length:strlen(argv[1]) encoding:NSUTF8StringEncoding] autorelease];
    }
    NSLog(@"Hello, %@", name);
    [pool drain];
    return 0;
}

No comments:

Post a Comment