我正在AdMob
用作 的备份iAd
,但我无法确定是否AdMob
交付..iAd
我可以检查isBannerLoaded
或检查什么,但不能检查AdMob
.. 无论如何,我现在一切正常,除非没有互联网连接!当iAd
无法加载广告并调用didFailToReceiveAdWithError
时,我会启动AdMob
. 对此进行测试时,我使用的错误原因是“没有互联网连接”,但 AdMob 并不称其为自己的didFailToReceiveAdWithError
. 对于 AdMob 而言,没有互联网连接似乎不是错误 ( GADBannerView*
)
如何判断 GADBannerView 是否失败?
编辑
好的,所以这里基本上是我的代码:
-(void)viewDidLoad
{
[super viewDidLoad];
[self initiAdBanner];
[self initAdMobBanner];
}
-(void)initAdMobBanner{}//initiates variable adMobBannerView(GADBannerView)
-(void)initiAdBanner{}//initiates variable iAdBannerView(ADBannerView)
-(void)hideBanner:(UIView*)banner{} //hides banner if visible
-(void)showBanner:(UIView*)banner{} //shows banner if hidden
//blah blah
-(void)adView:(GADBannerView*)banner didFailToReceiveAdWithError:(GADRequestError*)error
{
//Never gets called, should be called when both iAd and AdMob fails.
NSLog(@"AdMobBanner failed.");
[self hideBanner:banner];
}
-(void)bannerView:(ADBannerView*)banner didFailToReceiveAdWithError:(NSError*)error
{
//If iAd fails, due to no internet connection or whatever, then it calls this.
[self adMobRequest];
[self hideBanner:iAdBannerView];
[self showBanner:adMobBannerView];
}
当 iAd 失败并调用 时(ADBannerView*)didFailToReceiveAdWithError
,我启动了 AdMob,但是当没有互联网连接时,AdMob 不会调用(GADBannerView*)didFailToReceiveAdWithError
. 为什么?