{
NSDictionary *_dic;
}
NSURL *url = [NSURL URLWithString:“JSON链接”];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
_dic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(@"%@",_dic);
dispatch_async(dispatch_get_main_queue(), ^{
[tableview reloadData];
});
}];
[task resume];
// 第三方JSON解析
SBJsonParser *parser = [[SBJsonParser alloc] init];
_dic = [parser objectWithData:data];
// 第三方JSON解析
_dic = [data objectFromJSONData];