0

I have a User table in Back4app. I would like to query the table. I am using the below set of statement. It does not work. Please advise. The count always comes to zero.

PFQuery *query = [PFQuery queryWithClassName:@"User"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error){
    NSLog(@"%lu", objects.count);
    PFObject *obj = [objects firstObject];
    NSLog(@"%@", obj);
    NSString *str=[obj valueForKey:@"password"];
    NSLog(@"%@", str);
}];
Ye Min Htut
  • 2,904
  • 15
  • 28
Harish
  • 565
  • 1
  • 12
  • 34

1 Answers1

0

PFQuerys for PFUsers should be instantiated via [PFUser query]

So, you should replace this line

PFQuery *query = [PFQuery queryWithClassName:@"User"];

with this line

PFQuery *query = [PFUser query];

Hope this helps :)

Ye Min Htut
  • 2,904
  • 15
  • 28