I did the following:
1) Added iAd.framework into iOS project. i imported iAd/iAd.h and .m into project.
2) I opened AdMob account. In mediation i made iAd cpm higher than AdMob cpm.
3) Downloaded the AdMob SDK iOS 7.0 SDK into project and it comes with AdMob adapter. Imported GoogleMobileAds into .h and .m files in project
4) Downloaded the iAd adapter into project.
5) Under Build Settings in Other linker flags I added -ObjC so it's in debug and release.
It states in Admob Mediation instructions "There is no need to write additional code to create ad views from each ad network. The AdMob mediation SDK will invoke each ad network's adapters and SDK as necessary to create ads"
Not adding any code, doesn't work.
I have 1 ViewController for ads to share. 3 methods in that 1 VC. 1st= viewDidLoad method, 2nd= StartGame method, and 3rd= GameOver method. Then back to viewDidLoad after GameOver.
So Then I added iad code in viewDidLoad and made iad hide in didFailToReceiveAdWithError and AdMob show.
This made iAd load and iAd stays showing test banner for like 5 minutes before it fails and AdMob loads. However, AdMob instantly changes back to iAd after I leave the GameOver page and go back to viewDidLoad.
So I don't think mediation is working properly because the ad banners aren't supposed to be affected by any of the methods. What did I do wrong? How do I set up mediation properly?
My code:
-(void)viewDidLoad{
self.iAD = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 60, 375, 50)];
[self.iAD setDelegate:self];
[self.view addSubview:self.iAD];
}
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
self.iAD.hidden=NO;
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
[self.iAD setAlpha:0];
self.iAD.hidden=YES;
self.bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
self.AdMob.adUnitID = @"my-unit-id";
self.AdMob.rootViewController = self;
self.AdMob.delegate = self;
[self.view addSubview:self.AdMob];
GADRequest *request =[GADRequest request];
request.testDevices = @[ @"278b11d6d1cb3f7d10414d6b2686d0e5 ];
[self.bannerView loadRequest:request];
}