I'm trying to use a segue, here's my code:
if let status_code = response.response?.statusCode {
if status_code == 200 {
// register is ok
// cancel all warnings
self.usernameField.hidden = false;
self.usernameFieldError.hidden = true;
self.usernameShortError.hidden = true;
self.usernameTakenError.hidden = true;
self.performSegueWithIdentifier("registerToFeed", sender: self);
}
}
(I've cut the code for length)
So here's the problem: the segue is simply not executed. I've put a breakpoint on it to see what happens, and the execution flow just passes on it, and do nothing, quite frustrating.
I've read that performSegueWithIdentifier needs to be called on the main thread, so I called NSThread.isMainThread()
just before my segue call, and it returned me true
.
I also double checked if the identifier name was the same as the one i'm calling and that's the case.
I tried to do
dispatch_async(dispatch_get_main_queue()){
self.performSegueWithIdentifier("registerToFeed", sender: self)
}
as I've seen in another SO thread, but still not working, nothing gets executed.
So I don't know why this simple line doesn't get executed. Thank you for your help.
EDIT: so here's the full RegisterViewController.swift
file:
http://pastebin.com/dpBBXhe8
The problem is that the program crashes at line 190 because the performSegue is not executed.