0

I have this code

if ([sessionOutput isEqualToString:@"valid"]) {
    LoggedInViewController *loggedin = [[LoggedInViewController alloc] initWithNibName:nil bundle:nil];
    [self presentViewController:loggedin animated:YES completion:nil];
}

Except when it goes to change the view i get this message:

 Warning: Attempt to present <LoggedInViewController: 0x717fec0> on
<ViewController: 0x8a64af0> whose view is not in the window hierarchy!

What am i doing wrong?

Cezar
  • 55,636
  • 19
  • 86
  • 87
  • Not an Xcode question. –  Mar 09 '13 at 22:17
  • yes it is? im coding this in Xcode – Daniel Winter Mar 09 '13 at 22:21
  • That doesn't matter, really. Excerpt from the [Xcode tag wiki](http://stackoverflow.com/tags/xcode/info): "This tag should only be used for questions about Xcode itself, not general Mac or iOS programming topics" –  Mar 09 '13 at 22:24

1 Answers1

0

Try moving your code to viewDidAppear:.
<ViewController: 0x8a64af0> haven't been added to the view hierarchy by the time viewDidLoad: is called.

See this question: whose view is not in the window hierarchy

Community
  • 1
  • 1
s1m0n
  • 7,825
  • 1
  • 32
  • 45