AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
//设置解析器类型
manager.responseSerializer = [[AFJSONResponseSerializer alloc]init];
NSURL *url = [NSURL URLWithString:TEST_URL];
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url];
NSURLSessionDataTask *task = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
self->_dic = responseObject;
[self->_tbv reloadData];
}];
[task resume];
}
网友评论