解析:将查询与查询匹配到指针

时间:2015-10-07 18:04:38

标签: swift parse-platform pfquery

所以我试图从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)
    }
  }
} 

1 个答案:

答案 0 :(得分:2)

看起来您没有正确查询User类。见This StackOverflow answer。您应该使用“_User”类,或者更合适的是var query : PFQuery = PFUser.query()而不是var query : PFQuery = PFQuery(className: "_User")