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

Friend Request with PFUSers

Hey guys Im wondering how I can build a friend request feature in my app between users.(Add,deny,etc). Also only friends can see each others profiles. Any idea where to start?

4 Answers

would probably use a PFRelation. ("hasFriendRequests") and display those request using that relation in a tableView or something similar.

So, when a user sends a friend request, add that user to the requested friends "hasFriendRequests" relation. then when the requested friend accepts or denies that request remove the user from the relation, and either add the user as a friend using another "friendsRelation" or do nothing if he denied it.

SO should I create a another class?

if you want you can. You could create a FriendRequest class that has some attributes (the user the request is for, the user who sent that request etc) and use that in your relation instead of just using PFuser. using a separate class seems like the way to go in my opinion

Do you have example code of where I should start? For example i have a "Edit Friends View Controller" where if you click the cell,it adds a check mark and adds that user to the "Friend View Controller" list. .

?