0

In this scenario back4app initialised successfully, user login and signup also working, but when I am fetching all user list by using the below code, its returning blank array, without any error, there are three users in the User class in back4app. Can anyone help?

 let query = PFQuery(className: "User")
            query.findObjectsInBackground { (result, err) in
                 print(result)
                 print(err)
            }
rici
  • 234,347
  • 28
  • 237
  • 341
YesAbhi
  • 5
  • 1
  • 6

1 Answers1

0

The User class was created by the Parse server. And that is the reason why is it a protected class. To reach these kinds of classes you need to use underscore character before the class name.

I mean don't use User for className, use it: _User

   // let query = PFQuery(className: "User")
   let query = PFQuery(className: "_User")
   query.findObjectsInBackground { (result, err) in
         print(result)
         print(err)
   }
asilturk
  • 198
  • 1
  • 7