I'm dealing with a segue problem and it's getting ridiculous.
I'm performing it like how I always do in a view controller named LoginViewController
:
- (void)loginSuccessfullyAccomplished
{
[self performSegueWithIdentifier:@"switchToHome" sender:self];
}
The method above is called from another Class, where some other signing in actions is performed asynchronously, and when it is done, it calls this method from LoginViewController.m
:
// Some Code
.
.
.
.
case VIDYO_CLIENT_OUT_EVENT_SIGNED_IN:
{
/*** Notifying upper layer ( Login View Controller ) from signing in ***/
UIStoryboard *storyboard;
if ( IDIOM == IPAD )
{
storyboard = [UIStoryboard storyboardWithName:@"MasterStoryboard-iPad" bundle:nil];
}
else if ( IDIOM == IPHONE )
{
storyboard = [UIStoryboard storyboardWithName:@"MasterStoryboard-iPhone" bundle:nil];
}
UINavigationController *nav = [storyboard instantiateInitialViewController] ;
dispatch_async(dispatch_get_main_queue(), ^{
[nav.viewControllers[0] loginSuccessfullyAccomplished];
});
break;
}
.
.
.
.
//Rest of the code
Now, Here's the problem :
loginSuccessfullyAccomplished
is being called successfully (Used breakpoints to make sure of that), But I don't see the second view controller to appear on the screen.
I get no error and no exceptions when performSegue
is executed, that means I'm not making any mistake regarding the segue identifier or first view controller from which the segue is being performed.
I'm also sure that I'm using a push segue and I HAVE embedded my view controllers in a navigation controller.
Just to make sure I'm not doing anything wrong with the segue itself, I implemented prepareForSegue
method and it IS BEING called. I also have checked that it is pointing to correct destination :
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ( [segue.destinationViewController isKindOfClass:[UserHomeViewController class]] )
{
NSLog(@"YES");
}
}
The second view controller IS NOT visually similar to first view controller, so I definitely will notice if it changes.
I have no idea what is going wrong. Any suggestions is really appreciated.
Thanks.
P.S: I know there're dozens of " performSegueWithIdentifier
not being called " questions but none of them helped my case!!!