gpt4 book ai didi

ios - 警告 : Attempt to present on whose view is not in the window hierarchy

转载 作者:行者123 更新时间:2023-11-28 22:19:11 25 4
gpt4 key购买 nike

我正在尝试使用此代码连接到我的 ViewController:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone_Storyboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"details"];
[self presentViewController:vc animated:YES completion:nil];

但是我收到此错误消息:

Warning: Attempt to present <MyViewController: 0x10c5771a0> on <UINavigationController: 0x10c533da0> whose view is not in the window hierarchy!

我在 UIAlertView 委托(delegate)方法中调用 segue:

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{

}

最佳答案

您的 UIAlertView 的窗口是最前面的 UIWindow,因此您的 View Controller 无法呈现。您需要等到警报 View 消失。最简单的方法是使用 alertView:didDismissWithButtonIndex:(而不是 clickedButtonAtIndrx)。

关于ios - 警告 : Attempt to present <MyViewController: 0x10c5771a0> on <UINavigationController: 0x10c533da0> whose view is not in the window hierarchy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20865327/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com