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
Woongshik Choi
42,387 PointsCode Challenge: Removing Friends by Tapping on a Table View Cell 3 of 3
Hello, Below this is my code for the challenge. By the way I am not sure how I should use the block for it.
#import "FavoriteMoviesViewController.h"
@implementation FavoriteMoviesViewController
- (void)addVideoToPlaylist:(PFObject *)video {
// Add custom code below!
PFRelation *relation = [self.playlist relationforKey: @"videos"];
[relation addObject: video];
[video saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error)
{
if (error)
{
NSLog (@"Error %@ %@", error, [error userInfo]);
}
else
{
[video saveInBacgkround];
}
}];
}
@end
Woongshik Choi
42,387 PointsHi Alex.
I fixed the spell error that you pointed out. By the way I still get this error below.
Compilation Error! Make sure you are sending the correct 'save' message to the 'playlist' property.
Sean Lee
5,196 Pointstry using saveInBackground without "WithBlock".
[self.playlist saveInBackground];
1 Answer
Michael Jones
Python Development Techdegree Graduate 38,554 PointsHi,
You don't need to pass the block message -
[video saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error)
The answer is -
[self.playlist saveInBackground];
Woongshik Choi
42,387 PointsThanks! Michael.
Alex Hedley
16,381 PointsAlex Hedley
16,381 PointsThe g and the k in Background are the wrong way round. saveInBacgkround => saveInBackground
What error message were you getting from the code challenge?