Reputation: 1
I want to use iAd and AdMob on the same iphone app .
If the IAd fail to get an ad, i want to use admob. when iAd can serve again, i want to stop using AdMob.
Now, I implemented both ad views and delegates..but i want to make sure how to :
Thanks in advance.
Upvotes: 0
Views: 3369
Reputation: 368
I've come across the same problem. But I seemed to have a solution, although it doesn't seem to be the best one. AdMob doesn't seem to offer the method. But anyway,
I was able to solve this by,
hiding bannerView_
bannerView_.hidden = YES;
to stop requesting,
and
Simply calling loadRequest to resume requesting like so,
GADRequest *request = [GADRequest request];
[bannerView_ loadRequest:request];
Upvotes: 5
Reputation: 493
There are methods that handle events in case of loading an ad or failing to get one.
Assuming you start with iAD (which has less coverage than admob), you init the iAD and if it doesnt have an ad then
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
<perform a method to load admob>
}
at this poing admob will load displaying an ad. The iAD will continue to to try to fetch an AD. When it gets one then
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
<perform methods to remove admob>
<perform methods to show iAD>
}
you can have all ads hidden at init (alpha = 0, have them offscreen) and when it gets an ad, show it (alpha = 1, adview.frame = CGRectoffset (adview.frame, 0, + adheight) or something similar)
Upvotes: 0