知道操作何时完成

时间:2013-08-23 10:04:44

标签: ios afnetworking

我正在使用AFNetworking lib解析JSON数据:

-(void)getAbs:(NSString*)link{

    NSString *linkk=@"http://localhost:8080/Students/StudentWS/nb_abs/?student=";

    NSURL *url= [ NSURL URLWithString:linkk];


    NSURLRequest *request = [NSURLRequest requestWithURL:url];

    AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
        arrayofStudentID=[JSON valueForKeyPath:@"id"];
        arrayofStudentName=[JSON valueForKeyPath:@"name"];
        arrayofAbs=[JSON valueForKeyPath:@"abs"];


        [[self stdTableView] reloadData];

    } failure:nil];

    [operation setDownloadProgressBlock:^(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) {
        //HUD Code


    }];

    [operation start];

}

我想在执行操作后验证arrayofStudentID是否有0个元素。

if([arrayofStudentID count]==0){
//some code
}

感谢您的帮助。

0 个答案:

没有答案
相关问题