在 iOS 上,当我显示 Chartboost 插页式广告时,当我点击插页式广告时,“有时”(是的.. 并非所有时间)出现以下消息:
Warning: Attempt to present on whose view is not in the window hierarchy!
我只是这样调用 Chartboost:
[[Chartboost sharedChartboost] showInterstitial:CBLocationGameOver];
在启动时我缓存了这个插页式广告:
[[Chartboost sharedChartboost] cacheInterstitial:CBLocationGameOver];
这个问题我真的不懂。而且不是所有的时间。我无法解释和理解为什么有时它会起作用(当我触摸插页式广告时,我打开了 App Store)以及为什么有时插页式广告就消失了,什么也没有发生。
我从 3 或 4 个月开始就尝试向 Chartboost 询问这个问题,但我从来没有得到一个好的答案。
最佳答案
您应该指定 Chartboost 显示广告的 View 。为此,有一个方法调用:
[[Chartboost sharedChartboost] setRootView:YOUR_VIEW];
通过这句话,您可以让 Chartboost 在特定 View 中显示广告。
你应该在调用“showInterstitial”之前调用这个
更新:
在 SDK 5.0 版本中,他们改变了这种方法。现在你应该使用
[Chartboost showInterstitial:{view Controller} location:CBLocationHomeScreen];
但对于某些版本,此方法不会出现在 Chartboost.h 文件中。如果是这种情况,只需在此文件中添加以下行:
+ (void)showInterstitial:(UIViewController *)viewController
location:(CBLocation)location;
关于ios - Chartboost 插页式 : "not in the window hierarchy!" warning,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24139244/