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

Help with Task 3: Code Challenge - Displaying Our List of Friends

I have been going crazy trying to get past this task. I have been flying through until now. Can someone please advise me on what I am doing wrong.

Here is the Task: Next, add a PFQuery variable and set it with the query associated with 'moviesRelation' property.

Here is my code: (including the code from the previous task)

PFUser *currentUser = [[PFUser currentUser] objectForKey:@"moviesRelation"];
PFQuery *query = [self.moviesRelation query];

Thank you in advance for your help!!

4 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

The first line of your code should assign the resulting value to your property moviesRelation and not to currentUser. You created the property moviesRelation so that you hold the relation data.

Duh... I should have noticed that!! Thank you for the help, Amit!!!

The answer is:

self.moviesRelation = [[PFUser currentUser] objectForKey:@"moviesRelation"];
PFQuery *query = [self.moviesRelation query];

Still not understanding this... Surely the first line of the code is perfect as it passed the code challenge?

And the final code is:

import "FavoriteMoviesViewController.h"

@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){ if(error){

  }else{

  }
}];

}

@end