let userQuery = PFUser.query()
userQuery!.whereKey("username", equalTo: userUsername)
userQuery!.findObjectsInBackgroundWithBlock({ (result:[PFObject]?, error:NSError?) in
currentProfilePageUser = result![0] as! PFUser
})
This is my code. I'm trying to get a PFUser with only the username. But, I added breakpoints inside findObjectsInBackgroundWithBlock and discovered that it is not getting called. Therefore, I cannot receive my data. Why isn't findObjectsInBackgroundWithBlock getting called?
let query = PFQuery(className: "Follow")
query.whereKey("followFrom", equalTo: PFUser.currentUser()!.objectId!)
query.whereKey("followingTo", equalTo: currentProfilePageUser)
query.findObjectsInBackgroundWithBlock { (result:[PFObject]?, error:NSError?) in
if result == nil{
print("currentuser is not following this user")
self.followButtonTitle.setTitle("Follow", forState: .Normal)
}else{
print("currentuser is follwing this user")
self.followButtonTitle.setTitle("Unfollow", forState: .Normal)
}
}
For some really weird reason, the first findObjectsInBackgroundWithBlock works now, but this other one doesn't get called. This is very weird.