-2

This is the log of my nsarray with two strings.

GROUPSFORDISPLAY (
"Serie A",
"Serie B"

And this is exactly what I want do show in tableviewcells, but app is crashing instead. The code I'm using is:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath  *)indexPath object:(PFObject *)object {
    static NSString *CellIdentifier = @"Cell";

    PFTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[PFTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }



    NSString *series = [_seriesForDisplay objectAtIndex:indexPath.row];
    cell.textLabel.text = series;

Thanks.

Wain
  • 118,658
  • 15
  • 128
  • 151
ferrojr
  • 339
  • 2
  • 4
  • 9

1 Answers1

2

It says your array's count is 2 and you're accessing 3rd item . So please try to use this one.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    return _seriesForDisplay.count;
}
Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66