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

General Discussion

Code Challenge: Adding the Edit Friends Screen 3/3

So I've managed to get to this stage but I'm not sure what I should be doing :/

"Finally, in the else condition, set the 'apps' property of this view controller using the data returned in the block. Then reload the data in the 'tableView' property of this view controller."

This is what I currently have

#import "AppsViewController.h"
#import <Parse/Parse.h>

@implementation AppsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *Apps = @"Apps";
    PFQuery *query = [PFQuery queryWithClassName:[NSString stringWithString:Apps]];

    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (error) {
            NSLog(@"Error: %@ %@", error, [error userInfo]);
        }
        else {

        [self.tableView reloadData];
        }
    }];
}

@end

Just not sure how I set the apps property?

EDIT: Solved - Didn't realise i was called an @property

2 Answers

Marco Lavielle
Marco Lavielle
2,246 Points

WHAT IS THE ANSWER!!!???? :O

Gabriel Morales
Gabriel Morales
11,315 Points
#import "AppsViewController.h"
#import <Parse/Parse.h>

@implementation AppsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    PFQuery *query = [PFQuery queryWithClassName:@"Apps"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (error) {
            NSLog(@"Error: %@ %@", error, [error userInfo]);
        }
        else {
        self.apps = objects;
        [self.tableView reloadData];
               }
    }];   
}
@end

This is the answer.