0

我尝试使用下面的代码将 Json 解析数据与表视图绑定并获取异常。我也在使用 ASIHttpRequest 和 Json。

**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;
4

1 回答 1

1

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

于 2012-12-10T21:23:50.177 回答