所以我试图从facebookIdList获取具有用户匹配的facebookId的用户(指向User的用户)的所有UserSports。 facebookIdList包含id:s。但是对象有0个值。有什么想法吗?
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)
}
}
}
答案 0 :(得分:2)
看起来您没有正确查询User类。见This StackOverflow answer。您应该使用“_User”类,或者更合适的是var query : PFQuery = PFUser.query()
而不是var query : PFQuery = PFQuery(className: "_User")