iOS Programming using Xcode IDE and Objective C: My take


For people in hurry get the latest code and open this example in Xcode IDE and run the example.

In my 22 yrs, all along I have been either a Microsoft technology programmer or a Java programmer. I always wanted to understand “the dark side” of application development, iOS Programming using Xcode IDE and Objective C. iOS Programming is all about Programming for iPad and iPhone class of devices. This weekend, I had an opportunity to tryout few things,

  • How can you compare Xcode IDE to something like Eclipse or Visual Studio? Are there any build tools like Ant or Maven in this part of the world? Are there any tools for Dependency management similar to Maven repository?
  • How similar or different is Objective C compared to Java or C++

After trying out, my opinion has changed about iOS programming. I really started liking it. As with any tools, there is a learning curve. Once you get past it, it is cool. Xcode IDE is very well integrated with iPhone/iPad simulators.

If you want to start development, as a prerequisite, we need a Mac system and you need to download Xcode. If you want to upload your applications in App Store you need to signup for $99 iOS developer program. This will also get you ton of goodies like Beta tools you can try out.

Xcode: My take

My couple of days experience with Xcode, I started liking it. For a starter, there are few tutorials on youtube from iffytheperfect1983, please try out these and you will quickly get a grasp of Xcode, Objective C, Cocoa, Cocoa Touch. Cocoa framework is used to develop OS X applications and Cocoa Touch is used to develop iPad/iPhone based application. I tried JSon Parsing tutorial, SQLite tutorial and Grand Central Dispatch tutorial and liked all of them. There is also a Basic Calculator tutorial, you will like it. I suggest, open your Xcode and work along these tutorials, you will quickly get a hang of Xcode and Objective C. Xcode also has SenTest a good unit testing framework, I haven’t explored it yet.

Xcodebuild: My take

There is a materials on the web that talks about Xcodebuild and CocoaPod. I tried Xcodebuild, this is similar to ant. They say CocoaPod is a dependency management tool similar to Maven. I haven’t tried it, in my next few blogs I will try and let you know. To run a simple xcodebuild command on a Xcode project you need to type in below command,


xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

Objective C: My take

This language looks very convoluted at first glance, but if someone knows C, they can pick this up. Reading through the web, it is clear Apple team consciously took decision to go with Objective C. Someone also spoke about Objective C philosophy. Someone compared C++ with Objective C.

Sample JSon Rendering application for iPhone

This is a simple example, where when we click a button, it will get the RSS feed of top 10 albums and bind it to a table view. The JSon structure looks as below,

iOS Programming using Xcode IDE and Objective C: JSon Rendering exercise

JSon structure to be used for iPhone/xcode application

The code sample is as below,


-(void)connectionDidFinishLoading:(NSURLConnection *)connection{

NSDictionary *allDataDictionary = [NSJSONSerialization JSONObjectWithData:webData options:0 error:nil];

NSDictionary *feed = [allDataDictionary objectForKey:@"feed"];

NSArray *arrayOfEntry = [feed objectForKey:@"entry"];

for (NSDictionary *dictionary in arrayOfEntry) {

NSDictionary *title = [dictionary objectForKey:@"title"];

NSString *label = [title objectForKey:@"label"];

[array addObject:label];

}

[[self myTableView]reloadData];

}

- (IBAction)getTop10AlbumButton:(id)sender {

[array removeAllObjects];

NSURL *url = [NSURL URLWithString:@"https://itunes.apple.com/us/rss/topalbums/limit=10/json"];

NSURLRequest * request = [NSURLRequest requestWithURL:url];

connection = [NSURLConnection connectionWithRequest:request delegate:self];

if(connection){
webData = [[NSMutableData alloc]init];
}
}

For more details, import my project into Xcode and run the example and understand the code flow.

I hope this example helped.

About these ads

One thought on “iOS Programming using Xcode IDE and Objective C: My take

  1. Pingback: Sample iPad app to work with JSon based Machine Learning System | GoSmarter Tech Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s