// 请求网络数据
// [self getjson];
[[UIApplication sharedApplication]setNetworkActivityIndicatorVisible:YES];
// 创建一个af管理对象
AFHTTPSessionManager *manger = [AFHTTPSessionManager manager];
// 设置让服务器响应二进制数据
manger.responseSerializer =[AFHTTPResponseSerializer serializer];
// 将网址get请求
[manger GET:@"https://www.zhaoapi.cn/data/content.json" parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
NSError *jsοnerrοr= nil;
id jsondata = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:&jsonerror];
// 解析成功,将得到的json数据赋值给表格的字典
self.tabdic = [jsondata mutableCopy];
dispatch_async(dispatch_get_main_queue(), ^{
[self huancun];
[self readarr];
[self.tableview reloadData];
});
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSLog(@"服务器错误");
}];