Skip to content

Instantly share code, notes, and snippets.

@laanlabs
Created April 23, 2011 15:05
Show Gist options
  • Save laanlabs/938679 to your computer and use it in GitHub Desktop.
Save laanlabs/938679 to your computer and use it in GitHub Desktop.
TapShare Example
NSString * messyIp = @"http://192.168.1.113:45543";
NSURL * url = [NSURL URLWithString:[NSString stringWithFormat:@"http://wifitransfer.appspot.com/api/v1/get_code?long_url=%@",messyIp]];
NSString * responseStr = [NSString stringWithContentsOfURL:url];
id obj = [responseStr JSONValue];
NSString * link = nil;
NSString * hash = nil;
id status = [obj objectForKey:@"status_code"];
if ( [status intValue] == 200 ) {
link = [[obj objectForKey:@"data"] objectForKey:@"url"];
hash = [[obj objectForKey:@"data"] objectForKey:@"hash"];
NSLog(@"Visit this website: %@" , link);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment