3

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?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Marcos Duarte
  • 3,472
  • 4
  • 19
  • 22
  • In what way does it not work perfectly? Are there any errors? – Fogmeister Sep 23 '15 at 13:46
  • Nothing happens, the screen is not pushed and no errors are presented, even though the code is executed. – Marcos Duarte Sep 23 '15 at 13:47
  • maybe check your storyboard if the the segue identifier is still "segue-start-app". if thats not the problem then post your prepare for segue – Lukas Sep 23 '15 at 13:52
  • The segue identifier is correct, I've checked. If it wasn't, XCode would throw a runtime error. Regarding the `prepareForSegue`, I only created it to check if it was being called, then removed it. My VC's code is exactly what you see above – Marcos Duarte Sep 23 '15 at 14:02
  • @MarcosDuarte, does the view that will be pushed contain a UITextField? – keno Sep 23 '15 at 14:06
  • @keno No, it contains a sub view controller that contains a `UITextView`. Anyway I don't understand why a text field could cause this problem, is it a bug? – Marcos Duarte Sep 23 '15 at 14:10
  • 1
    @MarcosDuarte, I had a similar issue recently and used the approach in the following answer to resolve it: http://stackoverflow.com/questions/32643765/ios-9-segue-causes-app-to-freeze-no-crash-or-error-thrown/32661264#32661264 – keno Sep 23 '15 at 14:13
  • Thanks @keno, that solved my problem! Could make this an answer so I can close the thread? Thanks again! – Marcos Duarte Sep 23 '15 at 14:35

2 Answers2

3

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

Community
  • 1
  • 1
keno
  • 2,956
  • 26
  • 39
0

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

emacos
  • 541
  • 1
  • 8
  • 17