Search code examples
iosadmobiad

integrate iAds with adMob on iOS together


I've used the following code for iAd integration...

-(void)bannerViewDidLoadAd:(ADBannerView *)banner{

    [UIView beginAnimations:nil context:nil];    
    [UIView setAnimationDuration:1];    
    [banner setAlpha:1];    
    [UIView commitAnimations];
}

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{    

    [UIView beginAnimations:nil context:nil];    
    [UIView setAnimationDuration:1];    
    [banner setAlpha:0];    
    [UIView commitAnimations];
}

I know the code for integrating Google's AdMob, but do I just add the code inside these iAd methods i used?


Solution

  • Go to Google's AdMob iOS guide site. That site gives you a tutorial of how to implement AdMob banners. Then you post that code in didFailToReceiveAdWithError and that'll mediate your iAd, AdMob banners. However, you should place the BELOW code in viewDidLoad instead.

     UIView beginAnimations:nil context:nil];
    
     [UIView setAnimationDuration:1];
    
     [banner setAlpha:1];
    
     [UIView commitAnimations];
    

    Also, it'll only mediate if you create an account with Google's AdMob and implemented the mediation settings. For example if you chose higher CPM for iAd then iAd will show first. If you put lower CPM for AdMob, AdMob will show when iAd fails to show.