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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Fabio Floris](https://uploads.teamtreehouse.com/production/profile-photos/120436/micro_225161_1075467801084_3884724_a.jpg)
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](https://uploads.teamtreehouse.com/production/profile-photos/5393/micro_NewProfile2.jpg)
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?