如何修复警告:景色是不是在窗口层次(How to fix the warning: view is

2019-08-18 01:15发布

我使用标准的安装过程MobclixiOS应用程序,我打电话requestAndDisplayAdFromViewController:从内部方法viewWillAppear:

    - (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [fullScreenAdViewController requestAndDisplayAdFromViewController:self];

}

这里是我得到的警告:

Warning: Attempt to present <MobclixFullScreenAdViewController: 0x14f2c0> on <EditGameViewController: 0x1838d0> whose view is not in the window hierarchy!

我希望这足够去。 谢谢你的帮助。

Answer 1:

你从viewWillAppear中调用它 - 在这点上,说法不一定是层次结构中(它会出现,但这并不意味着它已经出现还)。 尝试从viewDidAppear,当视图被证实是在层次结构被称为调用它。



Answer 2:

尝试移动你的代码[fullScreenAdViewController requestAndDisplayAdFromViewController:self];viewDidAppear



Answer 3:

您也可以尝试以显示viewDidLoad方法的视图。



Answer 4:

你应该试试这个代码移到viewDidAppear。

从viewWillAppear中的苹果文档:

This method is called before the receiver’s view is about to be added to a view hierarchy


文章来源: How to fix the warning: view is not in the window hierarchy