0

大家好,我收到推送通知,如果应用程序处于活动状态,我会向用户提供警报视图,无论他/她是否想查看通知。如果用户选择“是”,那么我会呈现一个模式,所有这些都在应用程序委托中完成。

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

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

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

而且我没有看到模态显示的窗口。

4

1 回答 1

1

控制器一次只能呈现一个模式。一个潜在的快速解决方法是在显示新的模态之前首先关闭一个潜在的模态:

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

// Then present
[self.window.rootViewController presentViewController:controller animated:YES completion:nil];
于 2013-10-07T12:20:58.380 回答