我已经广泛搜索了这个答案。用书面英语我试着做以下事情:
查询结果,其中“Issues”类中的“WorkGroup”列等于“Users”类中的“WorkGroup”列。
我尝试了无数的事情,包括; NotContainedIn,ObjectForKey,wherekey(matchesquery),includeKey,add pointers等。
let query = PFQuery(className: ISSUES_CLASS_NAME)
let now = Date()
query.whereKey(ISSUES_SUB_DATE, lessThanOrEqualTo: now)
query.whereKey(ISSUES_STATUS, notEqualTo: "Closed")
query.order(byDescending: ISSUES_SUB_DATE)
// Add Where Issues WorkGroup value = Users WorkGroup value.
let userQuery = PFUser.query();
// Set up user query
let issueQuery = PFQuery(className:"Issue");
issueQuery.whereKey("WorkGroup", matchesKey:"WorkGroup", inQuery:userQuery);
试试这个
func yes(){
let query = PFUser.query()
query?.findObjectsInBackground(block: { (objects: [PFObject]?, error: Error?) in
if error == nil{
for object in objects!{
self.array.insert(object.object(forKey: WorkGroup) as! String, at: 0)
let dataQuery = PFQuery(className: "Issues")
dataQuery.whereKey(WorkGroup, containedIn: self.array)
dataQuery.findObjectsInBackground(block: { (objects: [PFObject]?, error: Error?) in
if error == nil{
for object in objects!{
}
}
})
}
}
})
}
仔细检查括号