I'm trying to find which user commented on the blog post. but it always returns nil and total objects 0, i'm not sure what am i doing wrong. This is my code to get the user's username
var finduser:PFQuery = PFUser.query()
finduser.whereKey("ObjectId", equalTo: commentclass.objectForKey("byuser").objectId)
finduser.findObjectsInBackgroundWithBlock { (objects:[AnyObject]!, error:NSError!) -> Void in
if error == nil {
if let aobjects = objects {
let puser = (aobjects as NSArray).lastObject as? PFUser
cell.userName.text = puser?.username
println(puser) // returns nil
println(aobjects.count) // returns 0
}
}
}
It should be objectId and not ObjectId, also make sure there is no ACL set for the user object that might prohibit the requesting user from seeing this object.