Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

performSegueWithIdentifier won't push view

I've just updated Xxode to work with Swift 2.0. As usual, a lot of new problems showed up.

In my app I have a view controller that checks whether the user is logged in and present either login screen or the app's home screen. It's a pretty simple VC:

class WelcomeViewController : UIViewController {

    override func viewDidAppear(animated: Bool) {
        if PFUser.currentUser() == nil {
            self.performSegueWithIdentifier("segue-require-login", sender: self)
        }
        else {
            self.performSegueWithIdentifier("segue-start-app", sender:self);
        }
    }

}

That used to work perfectly, but now it doesn't. The segue segue-require-login is of type "Present modally" and it works fine. The segue segue-start-app is "Show (e.g. Push)", but the view never gets pushed, even though the code is being executed (even prepareForSegue is called).

I've tried re-creating the segue, performing a Clean, cleaning the project's build folder but nothing seems to help.

Any thoughts?

like image 543
Marcos Duarte Avatar asked Mar 17 '26 07:03

Marcos Duarte


1 Answers

There seems to be a bug in iOS 9 and Xcode 7 where if you have a UITextView with placeholder text, it prevents the segue from being triggered.

More explanation in the following answer: iOS 9 Segue Causes App To Freeze (no crash or error thrown)

To fix it, try removing the placeholder text for the UITextView

like image 152
keno Avatar answered Mar 18 '26 20:03

keno