我有这段代码
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!
我做错了什么?
答案 0 :(得分:0)
尝试将代码移至viewDidAppear:
在调用<ViewController: 0x8a64af0>
时,viewDidLoad:
尚未添加到视图层次结构中。