Hi all!
I've got a modal segue that goes from the initial view controller to a main menu view controller programatically. Then if you log out of the app, it change the view controller to the inital, programatically too. Here comes the trouble, if the code goes again to the main menu de debugger shows me:
Warning: Attempt to present <MainMenu: 0x170bf000> on <InitViewController: 0x16e9c7f0> whose view is not in the window hierarchy!
And it stays in the InitViewController. I've searched in a lots of forums and i got no idea of what to do.
Code from the initViewController:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"ToMainMenu"]) {
MainMenu *MM = (MainMenu *)segue.destinationViewController;
MM.managedObjectContext = [self managedObjectContext];
}
}-(void)loadMainMenu{
/
[self performSelector:@selector(logedIn)
withObject:nil
afterDelay:0.0];
}
-(void)logedIn{
[self performSegueWithIdentifier:@"ToMainMenu" sender:self];
}Code from the Main menu:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(UIButton *)sender
{
if ([segue.identifier isEqualToString:@"bToSplashScreen"]){
InitViewController *ivc = (InitViewController *)segue.destinationViewController;
ivc.managedObjectContext = [self managedObjectContext];
}
}- (IBAction)touchCerrarSesion:(UIButton *)sender {
[self performSegueWithIdentifier:@"bToSplashScreen" sender:self];
}Here is how my storyboard is:
Please help! 😟