Finally made my api login to work but I just bumped into a huge road block with redirecting to the main page after login. My storyboard looks like this

So I have all my processes on that submit button and after the validations pass I want to redirect to the Events page but it would always cache and would give me this exception:
Terminating app due to uncaught exception ‘NSGenericException’,
reason: ‘Could not find a navigation controller for segue
‘LoginSuccess’. Push segues can only be used when the source
controller is managed by an instance of UINavigationController.’
This is the line that pushes to the next page
if(user.isValid){
// go to next page
[self performSegueWithIdentifier:@"LoginSuccess" sender:self];
}
else{
// else refresh current page
}
Thanks guys!
Your login view controller should be embedded in a
UINavigationControllerif you want to use a push segue on it.You should have something like this:
EDIT: (from comments) If you really want to use a push segue, you need to put it in a navigation controller; else, you may have to change the screens via code (by changing
appDelegate.window.rootViewController), or via a modal segue. However, if you use a modal segue, you cannot show any other controllers using a modal segue. (You cannot show a controller modally if the current view controller has already been shown modally.)So far, I have only used the changing the rootViewController via code. If you embed the LoginViewController in the UINavigationController, you might have to handle the Back button as logout (when in EventsListViewController), or when popping view controllers in the navigation controller.