首先下载jsonkit的一个解析包http://download.csdn.net/download/enuola/4523160
//解析电脑本地数据
_dic = [NSDictionary dictionary];
NSURL *url = [NSURL URLWithString:JSON_URL];
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url];
[NSURLConnection sendAsynchronousRequest:request queue:[[NSOperationQueue alloc]init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
NSLog(@"response.MIMEType == %@",response.MIMEType);
if ([response.MIMEType isEqualToString:@"application/json"]) {
_dic = [data objectFromJSONData];
//打印数据信息
NSLog(@"dic 信息 --->%@",_dic);
//刷新控件
dispatch_async(dispatch_get_main_queue(), ^{
});
}
}];
}