0

I'm trying to get a user from a pointer which is pointing to that user from a different table ( the table is called Parental ) but I can not get the full user only objectId , this is my code:

PFUser *usuario = [PFUser currentUser];

self.listausuarios = [[NSMutableArray alloc] init];

PFQuery *query = [PFQuery queryWithClassName:@"Parental"];
[query includeKey:@"Users"];
[query whereKey:@"supervisado" equalTo:usuario];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {

    PFObject *parentalCompleto;

    if (!error) {

        NSUInteger contador = 0;

        for (parentalCompleto in objects) {

            PFUser *contacto = [parentalCompleto objectForKey:@"supervisor"];

            NSLog(@"User from query: %@", parentalCompleto[@"supervisor"]);
            NSLog(@"User from query 2: %@", contacto);
            NSLog(@"Current User: %@", usuario);

            [self.listausuarios insertObject:contacto atIndex:contador];

            contador = contador + 1;
        }

        [self.tableView reloadData];
    }
}];

This is the Parse database:

enter image description here

enter image description here

And this is the console output:

enter image description here

Why I can not get user data with " objectId : ZYcjtEEDjt "?

1
  • Have you taken a look at the two answers? Commented Dec 22, 2015 at 19:27

1 Answer 1

1

From first glance, it might be because you are including the key Users, which is not a column in your table. If you want the full object for supervisor or supervisado then you need to include those keys.

[query includeKey:@"supervisor"];
[query includeKey:@"supervisado"];

Only include the ones you need.

P.S. Reload your tableView on the main thread.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much! I have add [query includeKey:@"supervisor"] and runs! :D :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.