0

我刚刚使用 iAds 将我的第一个免费应用程序添加到应用商店,当广告加载时它工作正常,所以我已经阅读了很好的内容,似乎更好的方法是在 iads 失败时加载 admob。我可以让 iads 自己在那里工作,admob 在那里自己工作,但不能一起工作,任何帮助都会很棒。我需要在 didFailToReceiveAdWithError 时加载 admob。

我的 iAd 代码

    -(void) bannerViewDidLoadAd:(ADBannerView *)banner {
 [UIView beginAnimations:nil context:NULL];
 [UIView setAnimationDuration:1];
 [banner setAlpha:1];
 [UIView commitAnimations];

 }


-(void) bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
 [UIView beginAnimations:nil context:NULL];
 [UIView setAnimationDuration:1];
 [banner setAlpha:0];
 [UIView commitAnimations];


}

我的 admob 代码似乎只在 [super viewDidLoad] 中工作;

这是我的admob代码

CGPoint origin = CGPointMake(0.0,
                             self.view.frame.size.height + 2 - CGSizeFromGADAdSize(kGADAdSizeBanner).height); 


bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin];


bannerView_.adUnitID = MY_BANNER_UNIT_ID;


bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];


[bannerView_ loadRequest:[GADRequest request]];
4

1 回答 1

0

像这样将您的代码放在 iad didFailToReceiveAdWithError 代码中

-(void) bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
   [UIView beginAnimations:nil context:NULL];
   [UIView setAnimationDuration:1];
   [banner setAlpha:0];
   [UIView commitAnimations];

  //////Admob Code

  CGPoint origin = CGPointMake(0.0,
                         self.view.frame.size.height + 2 - CGSizeFromGADAdSize(kGADAdSizeBanner).height); 
  bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin];
  bannerView_.adUnitID = MY_BANNER_UNIT_ID;
  bannerView_.rootViewController = self;
  [self.view addSubview:bannerView_];
  [bannerView_ loadRequest:[GADRequest request]];
}
于 2013-08-04T14:04:16.553 回答