How to fix the warning: view is not in the window hierarchy

风流意气都作罢 提交于 2019-12-02 13:12:40

You're calling it from viewWillAppear - at this point, the view is not necessarily in the hierarchy yet (it WILL appear, doesn't mean it has appeared yet). Try calling it from viewDidAppear, which is called when the view is confirmed to be in the hierarchy.

Try to move your code [fullScreenAdViewController requestAndDisplayAdFromViewController:self]; to viewDidAppear.

You can also try to display the view in the viewDidLoad method.

You should try moving this code to viewDidAppear.

From the Apple documentation on viewWillAppear:

This method is called before the receiver’s view is about to be added to a view hierarchy
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!