0

我有这个代码

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

除非要更改视图,否则我会收到以下消息:

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

我究竟做错了什么?

4

1 回答 1

0

尝试将您的代码移动到viewDidAppear:.
<ViewController: 0x8a64af0>调用时尚未将其添加到视图层次结构中viewDidLoad:

看到这个问题:谁的视图不在窗口层次结构中

于 2013-03-09T23:04:30.823 回答