Share on Google+Share on Google+

iPhone Hello World in Objective C

This is a very simple objective c program of hello world example, in which you will learn how to create your first hello world program application in objective c using xcode.

iPhone Hello World in Objective C

This is a very simple objective c hello world program example, in which you will learn how to make your first hello world application on object c using xcode. If you are a worries, just follow the steps given below...

1. Open the xcode & choose "File->New Project"

2. Select "Command Line Utility" from left menu and then "Foundation Tool" as given in the image.

3. Name your project as "HelloWorld" & save the file.

4. Now open the project and click on "Build & Go" button. On click it will return " Hello, World!"
To see the output choose "run->Console" from Xcode menu. 

Now let's find out how the application is showing "Hello, World!".
When we have created the application in "Foundation Tool" the application contain two files in Source 1. HelloWorld_Prefix.pch & 2. HelloWorld.m, and by default these files are having some code in it.

Predefined code in HelloWorld.m file:

 #import <Foundation/Foundation.h>

  int main (int argc, const char * argv[]) {

  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

   // insert code here...

  NSLog(@"Hello, World!");

  [pool drain];

   return 0;


Only due to this code we are able to print hello world on the console. You can see in the code that one main function is created in which we have written all the functions. Here

NSLog(@"Hello, World!");" is used to show the string.

Download the code



Posted on: October 1, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null