我的一个ViewControllers里面有一个UITableView,它在加载cellForRowAtIndexPath
时崩溃并出现以下错误信息:
我已将NSLog
放置在该功能的各个部分以查看它崩溃的位置,但它们都已成功记录,因此我对它的去向感到困惑错。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"cellForRowAtIndexPath has begun");
// parse data for the respective section's items
NSDictionary *currentSectionDictionary = _matchCenterData[indexPath.section];
NSArray *top3ArrayForSection = currentSectionDictionary[@"Top 3"];
// Cell defaults
static NSString *CellIdentifier = @"MatchCenterCell";
MatchCenterCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
// if no cell could be dequeued create a new one
cell = [[MatchCenterCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [NSString stringWithFormat:@"Title"];
cell.textLabel.font = [UIFont systemFontOfSize:14];
tableView.separatorColor = [UIColor clearColor];
// if no results for that item
if (top3ArrayForSection.count-1 < 1) {
cell.detailTextLabel.text = [NSString stringWithFormat:@""];
[cell.imageView setImage:[UIImage imageNamed:@""]];
NSLog(@"no results for this item");
return cell;
}
// if results for that item found
else {
// Load images using background thread to avoid the laggy tableView
[cell.imageView setImage:[UIImage imageNamed:@"Placeholder.png"]];
NSLog(@"FOUND results for this item");
return cell;
}
}