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

How do Implement friend request with parse.com?

Hey guys having trouble trying figure out how to implement friend request between users ,along with parse.com .Any ideas or example code that could help me out?

4 Answers

I was wondering how to add a accept or deny function into the equation

I think you mean the code block to be executed:

[jon saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
       //if there is an error
        if (error) {
            NSLog(@"error: %@ %@", error, [error userInfo]);
        } else {
      // else, execute this code
     }
    }];

fick ingenting bror, men lycka till

To add friends to a current user,"Jon", make a relation to "Jon" and add users to that relation:

PFUser *jon = [PFUser currentUser];

//set a relation to that user
PFRelation *friendsRelation = [jon relationForKey:@"friendsRelation"];

//add friends (users) to that relation
[friendsRelation addObject:friendOfJon];

//save the user
[jon saveInBackground];

se där du går