0

So I have a page view controller setup and each of my pages has a back button that calls an unwind segue which when arriving at the root page controller calls another unwind segue to get back to the main menu:

func backButtonAction(sender:AnyObject!){
    println("ok")
    dispatch_async(dispatch_get_main_queue()) {
        self.performSegueWithIdentifier("unwindGameContentViewController", sender: self)
    }
    //self.performSegueWithIdentifier("loadFollowPatternViewController", sender: self)
    //self.performSegueWithIdentifier("unwindGamesContentViewController", sender: self)
}

and

@IBAction func unwindToViewController(sender:UIStoryboardSegue){
    println("blow")
    self.performSegueWithIdentifier("unwindGamesViewController", sender: self)
}

On the first page clicking the back button functions as usual but then the second and third page of the view controllers do not function at all. The backButtonAction function is called and the ok is printed but the unwind does not take place and the blow print line is not printed either.

I get no errors or warnings about storyboard or anything else.

My code used to work before Xcode 6.3 came out with the updated swift language, however I am not sure whether I broke the code before then or the update broke it.

Wyler
  • 77
  • 1
  • 8
  • While I'm not quite sure why this isn't working for you, it is a bit fishy that you're using an async task for a UI action like this. Normally a segue like this, that modifies the UI, would occur on the main thread. I'd recommend starting by removing your `self.perfomSegueWithIdentifier()` out of the `dispatch_aync()` call. – kbpontius Apr 15 '15 at 14:14
  • That was one of the solutions I found on line... It obviously did not solve the issue though – Wyler Apr 15 '15 at 16:05
  • The async is fine since it's getting placed on the main thread. Prolly isn't necessary but not that harmful in this case – Colin Swelin Apr 15 '15 at 23:41

0 Answers0