Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Display problems in Parse.com Tableview

I am trying to get data into my tableview, but can't seem to figure this out. I keep getting a "use of undeclared identifier 'cell'" error when I try to populate my tableview for the ribbit app:

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { PFObject *junkballers = [_junkArray objectAtIndex:indexPath.row]; [cell.textLabel setText:[junkballers objectForKey:@"name"]];

}

3 Answers

Check if you put a Cell Identifier in the Storyboard Cell.

maybe you need to initialize the cell variable too :P

I have the cell identifier as 'Cell'. Still doesn't work. I am about to bleed out the ears.

Try another more meanful name like junkballerCell.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

static NSString * CellIdentifier = @"junkballerCell";

// Use the correct method, I have not a Mac for test this code right now :P
UITableViewCell * cell = [tableView reuseCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

PFObject *junkballers = [_junkArray objectAtIndex:indexPath.row]; 

[cell.textLabel setText:[junkballers objectForKey:@"name"]];

return cell;
}

This worked! Thanks so much! I think I just had to rename the identifier.