Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


parse.com cant create a relation

" Build a Self-Destructing Message iPhone App " Im trying to program a many-to-many relation, doing it as the documentation shows (and the video here). Im trying to check friends then i hit the "back" button and it shows nothing. so i checked the the "friendRelation" column and i have no relation with any of the other user ive created. the relevant code is:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];

    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
    self.currentUser = [PFUser currentUser];
    PFRelation *friendsRelation = [self.currentUser relationforKey:@"friendsRelation"];
    PFUser *otherUser = [self.allUsers objectAtIndex:indexPath.row];
    [friendsRelation addObject: otherUser];
    [self.currentUser saveInBackground];

Thanks for the help

1 Answer

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Hi Amit,

I think this might be related to a bug in the code. In FriendsViewController and CameraViewController, I am setting friendsRelation in the viewDidLoad method. That line needs to move to viewWillAppear, however. I recorded a fix in the next project (which will be a continuation of this one).

Sorry for the confusion! Hopefully that fixes it for you. I'll add a note to that video, too.