Currently I have synced user and their data on the parse backend. So what I want to do is to have user details page appear if the users have not stated their user details. So there will be the login page which will lead you to the protected page (which will show user details) and if there are no details to be retrieved, the page would perform a segue to the user details page.
var query = PFQuery(className:"UserSettings")
var CurrentUser = PFUser.currentUser()
query.whereKey("user", equalTo: CurrentUser!)
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]?, error: NSError?) -> Void in
if objects == nil {
self.performSegueWithIdentifier("fillUserDetails", sender: self)
}
However, the segue does not seem to execute and it remains on the protected page rather than directing the new user to the user details page. Any help would be greatly appreciate and thanks in advance.
add check of object's size and null both because objects will null when any error occurs in request, otherwise object will not null but it can have 0 data.
swift -