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

Displaying List Of Friends Challenge 4of4 what am I doing wrong here?

@implementation FavoriteMoviesViewController

- (void)viewDidLoad ,NSError *error
    [super viewDidLoad];
    // Add custom code below!
    self.moviesRelation=[[PFUser currentUser] objectForKey:@"moviesRelation"];
    PFQuery*query=[self.moviesRelation query];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (error){

        }
        else{

        }
    }];


@end

2 Answers

Miles,

Can you post a link to the video/challenge that you have the question on? The method signature does not look correct with the NSError *error parameter is this just a formatting issue in the post? viewDidLoad does not have any parameters.

Did you choose your own name for the PFRelation variable? I beleive that it was called friendsRelation in the video. The value will need to be consistent where ever it is used, in your code as well as in Parse.

- (void)viewDidLoad
{
    //all your code here
}
PFRelation *friendsRelation;
Greg Barbosa
Greg Barbosa
9,874 Points

I didn't put an if-else block in my Code Challenge and it worked for me.

@implementation FavoriteMoviesViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Add custom code below!

  self.moviesRelation = [[PFUser currentUser] objectForKey:@"moviesRelation"];
  PFQuery *query = [self.moviesRelation query];
  [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error){
  }];

}