我在试图链接我的
UIViewController
时遇到了问题,但我最终得到了错误提示。Attempt to present ViewController whose view is not in the window hierarchy
以下是我的代码:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Wokay"])
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"Vibes"];
[self.window.rootViewController presentViewController:vc animated:YES completion:nil];
}
}
代码错误:
Warning: Attempt to present <ViewController: 0x110634bc0> on <Login: 0x10951e7f0> whose view is not in the window hierarchy!