JSON + iOS 5; GO! (Tutorial)

What is JSON? JSON stands for JavaScript Object Notation. It’s a super lightweight and human readable data format. Go check it out and run back here.

iOS 5 includes classes to deal with JSON natively. Which is awesome. Let’s do this!

Twitter has a service that gives you recent tweets in JSON format when you give it a URL. Like this:

https://api.twitter.com/1/statuses/user_timeline.json?screen_name=jmenter&count=10

That’ll give you my 10 most recent tweets in JSON format. Easy peasy. Let’s make an app.

In Xcode, New Project, Single View Application. Use ARC. Coolio.

Add a UITableView to the view. Add it as a property to the ViewController, add the data source and delegate and wire those up.

Add some methods to the ViewController.m: one to issue a request and one to handle it. Fix up the data source and delegate methods.

Done. This was not really a tutorial. Sorry to trick you.

Get the Xcode project here, check out the ViewController.m, and see how easy it is!

Advertisements

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

%d bloggers like this: