这里示范一个基础的Hello World程序。
1 2 3 4 5 6 7 8 9 10
| #import<Foundation/Foundation.h> int main(int argc, char *argv[]){ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSLog(@"Hello World!"); [pool drain]; return 0; }
|
以上是Xcode的旧版”Hello World”程序代码,在4.3.1 xcode的代码为:
1 2 3 4 5 6 7 8
| #import <Foundation/Foundation.h> int main(int argc, char *argv[]){ @autoreleasepool{ NSLog(@"Hello World!"); } return 0; }
|