Created
July 9, 2012 15:07
-
-
Save xiangyuan/3077067 to your computer and use it in GitHub Desktop.
jsonkit使用示例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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