As i have mentioned in my previouse article that All iPhone development is done in objective-c. Today i will start with a simple program using command line.
$ cat helloworld.h 1- #import <Foundation/Foundation.h>
2- int main (int argc, const char *argv)
4- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
5- NSLog (@"Hello World!");
6- [pool drain];
7- return 0;
compiling and running:
$ gcc -framework Foundation helloworld.m
Now we will understand the above code. Line numbers are for reference.
Line 1 include the base class
Line 4 declared for memory management. Reserves space in memory.
Line 5 NSLog is a function that displays the argument you pass in.
Line 6 Release the allocated memory pool
Line 7 Terminate the execution of main.