Marcos Duarte
Marcos Duarte

Reputation: 3502

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?

Upvotes: 3

Views: 1817

Answers (2)

emacos
emacos

Reputation: 561

I think I have the same problem: I have a UITabelView with cells created from a nib file, when a user tap a cell this method is called:

enter image description here

and when I have the following method prepareForSegue:: the application crashes: enter image description here

if I delete the line 129 Everything is ok , the method prepareForSegue:: open the right view and the label contactName is shown with its default text. If I modify the method as follows prepareForSegue:: get exactly what you expect, without having any type of error:

enter image description here

let me know if you also get the same result

Upvotes: 0

keno
keno

Reputation: 2966

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

Upvotes: 3

Related Questions