状态恢复会发出警告 - 导致无法解释的视觉偏差

时间:2014-05-13 23:49:55

标签: ios state-restoration

到目前为止,互联网没有对我发生的状态恢复警告的命中:

-[UIViewController(StateRestoration) decodeRestorableStateWithCoder:]: Warning - State Restoration for UIViewController has presented view controller, but view controller is either not in a window, or the window is hidden. Deferring presentation which might cause flashing when presentation is made after a turn of the run loop:
self: <SomeTabBarController: 0x16e91220>, presented view controller: <UINavigationController: 0x16dbe260>

TabBarController有一个视图,它将ViewController(vc1)推送到导航控制器上。 VC1然后以模态方式将NavigationController推送到自身,它具有以vc2开头的自己的一系列视图控制器。

当状态恢复时,它会闪回vc1(来自vc2的快照),最后再次显示vc2。

如果有人对我在哪里开始调查这一点有任何想法,那将是一个很大的帮助。

1 个答案:

答案 0 :(得分:1)

我设法通过制作窗口键并在application:willFinishLaunchingWithOptions:中显示来解决此问题。

- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self.window makeKeyAndVisible];
    return YES;
}