2013-08-04 88 views
0

我剛剛將我的第一個免費應用程序添加到iAds的應用程序商店中,這些廣告加載時工作正常,所以我有一個很好的閱讀,似乎更好的方法是讓admob當iads失敗時加載。 我可以讓iads工作在那裏自己和admob自己工作,但沒有在一起任何幫助將是偉大的。 我需要讓admob加載didFailToReceiveAdWithError。Admob在iAds失敗時加載

我對網絡成癮者的代碼

-(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代碼只似乎工作[超級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]]; 

回答

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]]; 
} 
+0

謝謝,這是我怎麼過的,但如果IADS失敗的答覆,屏幕就留空白&沒有admob.Ill繼續測試,也許我一直不走運,他們都失敗在一起。 – Mark