(Follow Up) – Getting Safe[r] Short links in your iOS App

This is a follow up to my original post on using McAfee’s URL shortening service, McAf.ee, in your iOS apps. I was able to find an API that makes the process even easier.

//First setup the URLs
NSURL *urlToShorten=[NSURL URLWithString:@"http://www.shawnsbits.com"];
NSString *mcafeeURLShortenerString=[NSString stringWithFormat:@"http://mcaf.ee/api/shorten?format=text&input_url=%@", SHKEncodeURL(urlToShorten)];
NSURL *mcafeeShortener=[NSURL URLWithString:mcafeeURLShortenerString];

//Get the result
NSString *mcafeeShortenedString=[NSString stringWithContentsOfURL:mcafeeShortener encoding:NSStringEncodingConversionAllowLossy error:nil];

That’s it! Much easier.

No comments yet.

Leave a Reply