This is a quick and easy way to do this. You will need to register the .ly bit and get the username and API key.
NSString *username = @"user";
NSString *apiKey = @"R_11111111111111";
NSString *url = @"yoururl.com";
NSString *shortURL = [NSString stringWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://api.bit.ly/v3/shorten?login=%@&apikey=%@&longUrl=%@&format=txt", username, apiKey, url]] encoding:NSUTF8StringEncoding error:nil];
source
share