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 trialVikram Pal
Courses Plus Student 307 PointsRemoving Friends Challenge 2/3
I put:
PFRelation *relation = [self.playlist relationforKey:@"videos", self.video relationforKey:@"videos"];
Hmm?
2 Answers
Patrick Donahue
9,523 PointsChallenge 1 asks you to implement relation. Challenge 2 asks you to add the object "videos" to relation. So you need to remove the ", self.video relationforKey:@"videos"];
1) PFRelation *relation = [self.playlist relationforKey:@"videos"]; 2) [relation addObject:video];
busterlabs
9,276 PointsTry this:
[self.playlist saveInBackground];
Vikram Pal
Courses Plus Student 307 PointsVikram Pal
Courses Plus Student 307 PointsHaving some trouble on 3 also
Finally, we need to save these changes up to the Parse back-end. The relation is part of the 'playlist' property, where 'playlist' is an instance of PFObject. Save 'playlist' in the background to save the changes to the relation (don't worry about using any blocks).
import "FavoriteMoviesViewController.h"
@implementation FavoriteMoviesViewController
(void)addVideoToPlaylist:(PFObject *)video { // Add custom code below! PFRelation *relation = [self.playlist relationforKey:@"videos"]; [relation addObject:video]; [self.playlist saveInBackground:^(BOOL succeeded, NSError *error){
}]; }
@end