2010年2月4日 星期四

iPhone Coding Recipe – Shortening URLs

Shorten URLs:

NSString *url = @"http://brandontreb.com";
NSString *apiEndpoint = [NSString stringWithFormat:@"http://api.tr.im/v1/trim_simple?url=%@",url];
NSString *shortURL = [NSString stringWithContentsOfURL:[NSURL URLWithString:apiEndpoint]
encoding:NSASCIIStringEncoding
error:nil];
NSLog(@"Long: %@ - Short: %@",url,shortURL);

source: http://icodeblog.com/2010/02/04/iphone-coding-recipe-shortening-urls/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+icodeblog+%28iCodeBlog%29

Posted via email from yinlin's posterous

沒有留言: