1

I currently have an issue with this error message, it will only ever appear once in the application.

Attempt to present <NavViewController: 0x1457c370> on <InitalStartupViewController: 0x145371a0> whose view is not in the window hierarchy!

The way the app functions is that it will ask the user to log on only once (unless the app is uninstalled) , then every time after that the user is directed to the following view controller (which would also happen after the user logs in). This is the only error message that shows after the user has logged in.

The ViewController that the user is directed to after logs in is being direct by :

 [self performSegueWithIdentifier:@"alreadyRegistered" sender:self];

I have seen that I should be dismissing the previous view controller but i have had no success with stopping this message.

In this case should I be doing something different to move to the final ViewController after logging in for the first time or every time after that.

TinMan7757
  • 148
  • 2
  • 10
  • Show us the method in which you present the `NavViewController`. Include the method's declaration, not just the body. – rob mayoff Sep 23 '14 at 15:44

2 Answers2

1

Assuming you are using storyboard, you can place a conditional in the viewDidLoad for the authenticationViewController as follows;

  - (void)viewDidLoad{
      [super viewDidLoad];
      // validate  authentication viewController being displayed

      if(dontDisplayauthenticationController){

         UIStoryboard *storyBoard = self.storyboard;
         UIViewController *targetViewController = [storyBoard instantiateViewControllerWithIdentifier:@"alreadyRegistered"];
         UINavigationController *navController = self.navigationController;


        if (navController) {
           [navController pushViewController:targetViewController animated:NO];
        } else {

           [self presentViewController:targetViewController animated:NO completion:nil];
        }

      }
  }

The authentication process remains the same; I.E. after authentication still call performSegueWithIdentifier

MDB983
  • 2,444
  • 17
  • 20
0

You have this issue because you're trying to present a view controller that's not embedded in (or part of) your navigation controller.

I have the same situation like you and I've posted an appreciated answer here: https://stackoverflow.com/a/12236177/1641848

Community
  • 1
  • 1
Razvan
  • 4,122
  • 2
  • 26
  • 44
  • Thanks for that, Although annoying at the moment its not adversely affecting the operation off the application, but it still needs to be dealt with. – TinMan7757 Sep 24 '14 at 14:28