I have PFQuery function in Swift that's supposed to act based on the returned objects. I've tried if error == nil, if objects != nil and if error == nil && objects != nil, but it always acts as if the keys "otherUser" and "responded" were equalTo what the query asked for, although "otherUser" is not found in the class "Requests" and "responded" equals to "False". (I shortened the actual full-length query because it was too long).
let query = PFQuery(className: "Requests")
query.whereKey("otherUser", equalTo: PFUser.currentUser()!.objectForKey("username") as! String)
query.whereKey("responded", equalTo: "True")
query.findObjectsInBackgroundWithBlock({ (objects, error) -> Void in
if error == nil && objects != nil{
print(objects)
print("disabling confirm button")
self.stopTime = self.defaults.integerForKey("intKey")
}else{
print("Did not respond yet.")
self.counter = 1200
self.storyboard
}
})
}
respondedto a string, rather than boolean? Also, this query should not returnobject == nilunlesserror != nil. In the event that no objects are found that match this query, you should return an empty array, not nil. Is that what's happening, perhaps? - Jake T.