简体   繁体   中英

'NSInvalidArgumentException' testViewController tableView:numberOfRowsInSection

I trying to bind the Json parse data with table view using below code and getting exception. I am using ASIHttpRequest and Json as well.

**Error details:**
webservice[2864:f803] 
*** 
Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[testViewController tableView:numberOfRowsInSection:]: 
unrecognized selector sent to instance 0x6ecc4e0' 
*** 

NSString *responseString = [request responseString];


SBJsonParser *parser=[[SBJsonParser alloc]init];
NSDictionary *obj=[[NSDictionary alloc]init];
obj=[parser objectWithString:responseString error:nil];

return obj.count;

NSString *responseString = [request responseString];
SBJsonParser *parser=[[SBJsonParser alloc]init];
NSDictionary *obj=[[NSDictionary alloc]init];
obj=[parser objectWithString:responseString error:nil];

NSMutableArray *statuses = [[NSMutableArray alloc]init];

for (NSDictionary *status in obj)
{

    [statuses addObject:status];


}
self.listdata=statuses;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: @"myCell"];    
if (cell == nil) {
    cell =  [[ UITableViewCell alloc ] initWithFrame:CGRectZero];
}

NSUInteger row = [indexPath row];
cell.textLabel.text = [listdata objectAtIndex:row];

return cell;

看起来您的表视图数据源未实现方法tableView:numberOfRowsInSection:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM