Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build a Self-Destructing Message iPhone App Relating Users in Parse.com Removing Friends by Tapping on a Table View Cell

Pedro GCA
Pedro GCA
20,683 Points

Ribbit iOS - FriendsViewController does NOT sync with back-end after First Open

After tapping on Edit and removing or adding friends, I tap on back button and the FriendViewController does NOT sync with the back-end. Actually I can tap even on Inbox and tap again on Friends, it does not sync with the back-end anyway.

this is my viewDidLoad Method:

- (void)viewDidLoad
{
    [super viewDidLoad];


    self.friendsRelation = [[PFUser currentUser] objectForKey:@"friendsRelation"];
    PFQuery *query = [self.friendsRelation query];
    [query orderByAscending:@"username"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (error) {
            NSLog(@"Error: %@", [error userInfo]);
        } else {
            self.friends = objects;
            [self.tableView reloadData];
        }
    }];

}

Is there something that I could do ? Why it is not showed on the video ?

2 Answers

Patrick Donahue
Patrick Donahue
9,523 Points

Try moving it to viewWillAppear

That will load the list every time the view is shown. ViewDidLoad loads only when that view is hit the first time.

Pedro GCA
Pedro GCA
20,683 Points

OK, sorry for this. I've just found the answer in the next video at Stage 4.

I posted it here because for me there is no sense in solving this in a stage called: "Capturing Photo and Video Using UIImagePickerController", naturally I assumed that the issue wasn't solved.

tks.