[英]AdMob interstitial shown only once on iOS
我在iOS应用上使用admob插页式广告。 我只能显示一次插页式广告,任何显示新插页式广告的请求都将失败(顺便说一句,从不调用代理)。
我的代码如下:
-(void) viewDidLoad
{
[super viewDidLoad];
[self allocateAndDisplayAd];
}
-(void) allocateAndDisplayAd
{
splashInterstitial_ = [[GADInterstitial alloc] init];
splashInterstitial_.adUnitID = @"ca-app-pub-MY-ID";
splashInterstitial_.delegate = self;
GADRequest *requestInterstitial = [GADRequest request];
[splashInterstitial_ loadRequest: requestInterstitial];
}
// below functions delegate are never triggered when requesting a new interstitial !!
- (void)interstitialDidReceiveAd:(GADInterstitial *)ad
{
[splashInterstitial_ presentFromRootViewController: self];
}
- (void)interstitial:(GADInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error
{
splashInterstitial_ = nil;
}
- (void)interstitialDidDismissScreen:(GADInterstitial *)ad
{
splashInterstitial_ = nil;
}
当应用启动时(在viewDidLoad中完成请求),插页式广告会正确显示,然后任何新请求(对allocateAndDisplayAd的调用)都会失败(无错误消息,永远不会调用委托函数)。
我试图设置splashInterstitial_ = nil; 因此我确定下一个请求将重新分配一个新的非页内广告,但无法显示多个广告。
任何帮助,将不胜感激。 谢谢
好,我找到了我的问题
从applicationWillEnterForeground显示插页式广告的任何请求都将被忽略...而我的第二个请求是从applicationWillEnterForeground完成的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.