So I'm trying to get all UserSports that has a user (pointer to User) with the matching facebookId in User from facebookIdList. facebookIdList contains the id:s. But objects has 0 values. Any ideas?
let userQuery = PFQuery(className: "User")
userQuery.whereKey("facebookId", containedIn: facebookIdList)
let query = PFQuery(className: "UserSport")
query.whereKey("user", matchesQuery: userQuery)
query.includeKey("user")
query.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
if error == nil {
if let userSports = objects as? [UserSport] {
print(userSports)
}
}
}
It looks like you aren't querying the User class properly. See This StackOverflow answer. You should be using the class "_User", or, more appropriately, var query : PFQuery = PFUser.query()
instead of var query : PFQuery = PFQuery(className: "_User")