Chartboost with Swift - Interstitial:如果未完成则预取。等等……但是没有广告?

Chartboost with Swift - Interstitial: prefetch if NOT complete. wait... but no ad?

我正在尝试将 Swift 中的 Chartboost 广告整合到我的项目中,并且已逐字遵循教程:

https://answers.chartboost.com/hc/en-us/articles/205853276

一切都已导入,在 App delegate 中我有:

Chartboost.startWithAppId(//stuff)
        Chartboost.setShouldRequestInterstitialsInFirstSession(false)
        Chartboost.cacheMoreApps(CBLocationHomeScreen)

//Chartboost

class func showChartboostAds()
{
    Chartboost.showInterstitial(CBLocationHomeScreen);
}

func didFailToLoadInterstitial(location :String!, withError error: CBLoadError)
{

}

func didDismissInterstitial(location :String! )
{
    if(location == CBLocationHomeScreen)
    {
        Chartboost.cacheInterstitial(CBLocationMainMenu)
    }
    else if(location == CBLocationMainMenu)
    {
        Chartboost.cacheInterstitial(CBLocationGameOver)
    }
    else if(location == CBLocationGameOver)
    {
        Chartboost.cacheInterstitial(CBLocationLevelComplete)
    }
    else if(location == CBLocationLevelComplete)
    {
        Chartboost.cacheInterstitial(CBLocationHomeScreen)
    }
}

然后在我的主视图控制器中:

AppDelegate.showChartboostAds()

我的应用程序在仪表板中处于测试模式,并且在真实设备上 运行 但我只是得到插页式广告:如果未完成则预取。等等...在控制台中。

为什么不显示任何广告?

我认为您正在尝试快速显示广告。尝试延迟 AD,这为我解决了问题。

顺便说一句,这个解决方案之所以有效是因为预取方法。当您调用广告时,Chartboost 预取似乎没有按时完成,这导致显示调用失败。

Chartboost 确实有一个委托方法,可以在预取完成时为您提供全部清除,可能值得一看:- (void)didPrefetchVideos;

Here's a link 转到页面的其余部分。

希望这对您有所帮助。