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
}
ご協力ありがとうございました。