-6
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *simpleTableIdentifier = @"SimpleTableItem";

    SimpleeTableCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    cell.TitleLabel.text = [tableData objectAtIndex:indexPath.row];
    cell.PlaceLabel.text = [placeData objectAtIndex:indexPath.row];
    cell.imageView.image = [UIImage imageNamed:[thumbnails objectAtIndex:indexPath.row]];
    cell.RankingsLabel.text = [rankingsData objectAtIndex:indexPath.row];
    cell.StatusLabel.text = [statusData objectAtIndex:indexPath.row];
    cell.DistanceLabel.text = [distanceData objectAtIndex:indexPath.row];



    return cell;
}

How can i solve this error?

trojanfoe
  • 120,358
  • 21
  • 212
  • 242

1 Answers1

-1

your tableData or placeData or XXXdata 's count is less than your cell's count.
you can make some breakpoint in these line.
cell.TitleLabel.text = [tableData objectAtIndex:indexPath.row]; cell.PlaceLabel.text = [placeData objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:[thumbnails objectAtIndex:indexPath.row]]; cell.RankingsLabel.text = [rankingsData objectAtIndex:indexPath.row]; cell.StatusLabel.text = [statusData objectAtIndex:indexPath.row]; cell.DistanceLabel.text = [distanceData objectAtIndex:indexPath.row]; you can also use tableData.count to see if it's out of range.

ferrisxie
  • 26
  • 1
  • @amuthakumari one or more than one of your `tableData` `placeData` `rankingsData` `statusData` and `distanceData` don't have enough object. This error is often come up with `objectAtIndex:` when the `index`parameter is beyond the array's count. For example ,you have an array with `array=@[0,1,2,3]`,which has 4 object ,and you call method like this `array objectAtIndex:5`. – ferrisxie Nov 18 '15 at 12:01