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 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.