gpt4 book ai didi

ios - 当应用程序打开并且我收到推送时如何添加 uiviewcontroller?

转载 作者:行者123 更新时间:2023-11-29 03:35:41 25 4
gpt4 key购买 nike

大家好,我收到推送通知,如果应用程序处于事件状态,我会给用户一个警报 View ,无论他/她是否想要查看通知。如果用户选择"is",那么我会呈现一个模式,所有这些都在应用程序委托(delegate)中完成。

[[[[UIApplication sharedApplication] delegate] window].rootViewController presentModalViewController:EO animated:NO];

到目前为止,一切正常,但是当我在应用程序中并且处于已呈现的模式时,我收到以下警告:

Warning: Attempt to present <ABCViewcontroller: 0x201f27f0>  on <SWViewController: 0x1f58c330> which is already presenting <UINavigationController: 0x201d3050>

我没有看到以模态方式呈现的窗口。

最佳答案

一个 Controller 一次只能呈现一个模式。一个可能的快速修复方法是先关闭潜在的模式,然后再显示新的模式:

// Dismiss
[self.window.rootViewController dismissViewControllerAnimated:NO completion:nil];

// Then present
[self.window.rootViewController presentViewController:controller animated:YES completion:nil];

关于ios - 当应用程序打开并且我收到推送时如何添加 uiviewcontroller?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19223595/

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