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

Thread - BreakPoint? Self Destructing App

So I just finished the video on how to show your friends in the friends tab and show the check when they are added. But when I run it, click on friends, then edit - it crashes. Xcode tells me this:

EditFriendsViewController.m:

PFUser *user = [self.allUsers objectAtIndex:indexPath.row]; cell.textLabel.text = user.username;

if ([self isFriend:user]) { <<<--- Thread 1: breakpoint 2.1
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else {
    cell.accessoryType = UITableViewCellAccessoryNone;
}

At the bottom of this code:

  • (BOOL)isFriend:(PFUser *)user { for (PFUser *friend in self.friends) { if ([friend.objectId isEqualToString:user.objectId]) { return YES; } }

    return NO; } <<<--- Thread 1: breakpoint 2.1

Could someone tell me what I did wrong?

1 Answer

Do you have the cell identifier set up in the storyboard?

And after that if/else statement do you have "return cell;"

I will assume that you have "-" before (BOOL) in the isFriend method.

This is what I can think of by just looking at your code.

I went through the video again to see if I had made any mistakes. But I can't seem to find where I went wrong. I put in Cell for the identifier as well.