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.

Fabio Floris
526 PointsPFRelation create with UiButton on Cell
Hello everyone ... I'm trying to create PFRelation using a button in a TableView with custom cell, but I can not create these relationships, I only creates a relationship with a specific user regardless of the cell that I select. ..
Where am I doing wrong?
- (IBAction)FFAddAmiciAction:(id)sender {
NSIndexPath *indexPath = [[self tableView] indexPathForSelectedRow];
PFObject *searchedUser = [self.objects objectAtIndex:indexPath.row];
PFUser *user = [PFUser currentUser ];
PFRelation *relation = [user relationforKey:@"Amic"];
[relation addObject:searchedUser];
[user saveInBackground];
}
1 Answer

Amit Bijlani
Treehouse Guest TeacherSet breakpoints to see if a row is being selected and which user you are getting back in searchedUser
variable
Fabio Floris
526 PointsFabio Floris
526 PointsAmit Hello and thanks for the reply ... In the end I managed to find the problem for the button ... was enough to set the action as [sender tag] and everything worked ...
I was following the tutorial on your friends list and show what friends are and what they are not friends through the checkmark ... Surely it is not my fault but I can not get it to work ...
In my tableviewController I also implemented the Search Bar could be the problem?? Could you help me understand with a practical example ... are two days that I try but I just can not understand how I can implement your tutorial within my viewcontroller with searchbar
import "FFPrincipal.h"
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherIs this question related to your other post: https://teamtreehouse.com/forum/searchbar-in-uitableview-using-parsecom?
These seem a little out of context. Can you make your entire project available via DropBox or put it up on GitHub?