Continuing from my part 1, in this section, we will discuss about how to use this helper in your own application.
Source Code
Download the source code here
MKBitlyHelper 1.0.zip
Documentation
With just three lines of code, you can shorten your URL using this wrapper.
Initialize the helper class with your loginname and apikey.
bitlyHelper = [[MKBitlyHelper alloc] initWithLoginName:@"yourlogin" andAPIKey:@"yourapi"];
In your application, you can either provide your application specific API or user provided API. Logging into the bit.ly api helps in tracking the click throughs and referrals. The classes doesn’t provide a login or APIKey by itself.
Now, shortening or expanding URLs is as easy as calling these functions.
NSString *shortURL = [bitlyHelper shortenURL:@"http://mugunthkumar.com"]; NSString *longURL = [bitlyHelper expandURL:shortURL];
Disclaimers and other yada yada…
Be forewarned that it may have errors. As Donald Knuth says,
Beware of bugs in the above code; I have only proved it correct, not tried it.
Feel free you use this code and re-distribute it. The source code must retain the copyrights and my attribution in any derivative works of the source code.
On your application, you might opt to attribute me in your app though it’s not mandatory. I would be happy if you do so
Follow me on Twitter
Related posts:
- Objective-C Singleton Template for XCode 4 Update:Nov 7th 2011: Get the latest ARC compatible template from...

Pingback: Consuming a RESTful Service (bit.ly) in an iPhone Application | Mugunth Kumar's Blog
Pingback: Tweets that mention bit.ly wrapper for Objective-C/iPhone | Mugunth Kumar's Blog -- Topsy.com
Pingback: An objective-C bit.ly wrapper - The iPhone Blog Forums
Pingback: Another