Mar 21

I wanted to write a simple Console application in Cocoa. I followed the same old XCode approach of creating a project from the IDE. I started the project with Fundation Tool. Then the rest is to enter the following code into <the name you have given.m> which is the only class in that project. Its simple and good for making services and console applications. This also helps you to understand simple Number & Array manipulations with Objective-C style.

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

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

NSMutableArray *ar = [[NSMutableArray alloc] init];

NSNumber *n;

int i;

for (i=0; i<10; i++)

{

n  = [[NSNumber alloc] initWithInt:(i)];

[ar addObject:n];

}

for(i=0; i<10; i++)

{

NSNumber *newN = [ar objectAtIndex:i];

NSLog(@”Stored: %@”, newN);

}

NSLog(@”Number init %d\n”, i);

    // insert code here…

    NSLog(@”Hello, World from Muthu!”);

[ar release];

    [pool drain];

    return 0;

}

Download complete project: ArrayTest.zip


Mar 21

I’ve been doing .NET development for about 10+ years. I recently started looking at Mac OS X development efforts. I had a hard time starting with that because of all of my Windows way of doing it. Finally, i got a hand on it. This is my version of Hello World application for Mac OS X 10.5 using XCode 3.1 (for iPhone Development). The IDE looks powerful. But as a first timer, i did struggle a little to get around.

Step 1: Launch XCode 3 and click File - New Project from the menu

 

 

Continue reading »