0

我正在使用 AFNetworking 库解析 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
}

谢谢您的帮助。

4

0 回答 0