我有这种方法可以到达 Web 服务并带回 JSON。该方法运行良好,问题是我想要一个旋转条进度,而该方法还没有带来任何东西。
-(void)loadJson{
NSString *urlString = [NSString stringWithFormat:@"%@",kGetURL];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
self.json = JSON;
[myTableView reloadData];
} failure:^(NSURLRequest *request , NSURLResponse *response , NSError *error , id JSON){
NSLog(@"Failed: %@",[error localizedDescription]);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"didn't reach the server"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
}];
[operation start];
}
谢谢你。