Skip to content

Instantly share code, notes, and snippets.

@xiangyuan
Created July 9, 2012 15:07
Show Gist options
  • Save xiangyuan/3077067 to your computer and use it in GitHub Desktop.
Save xiangyuan/3077067 to your computer and use it in GitHub Desktop.
jsonkit使用示例
// Do any additional setup after loading the view, typically from a nib.
NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.imdida.org/json/city/ip"]];
NSURLResponse * response;
NSError *error;
NSData * jsonData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSDictionary * results = [jsonData objectFromJSONData];
NSLog(@"%@",[results objectForKey:@"ip"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment