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.
The block is executed on background thread. When you update your UI you should do that on the main thread. Try wrapping the
performSegueWithIdentifierin a block like this: