There are tons of similar questions here, but none of the solutions are working on the latest AdMob SDK. At least I couldn't make it work.
Loading:
- (void)AdMob_Banner_On
{
bannerView_.adUnitID = kAdMobID;
bannerView_.rootViewController = self;
[bannerView_ loadRequest:[GADRequest request]];
(...)
}
They are running perfectly, and now removing... all solutions I found are quite simple, but they don't work:
- (void)AdMob_Banner_Off {
NSLog(@"Admob: Turning Off");
bannerView_.hidden = YES;
[bannerView_ removeFromSuperview];
[bannerView_ setDelegate:nil];
bannerView_ = nil;
}
Some times I need all screen available, I can't show ads all the time. Any ideas?
In case anyone has the same problem, here is how I fix it.
The problem was that I was that the lines on the "AdMob_Banner_On" method were inverted.
Although the banner was showing up perfectly, it made the bannerView_ unable to respond to any other command, so even if the AdMob_Banner_Off was called, nothing was happening.
Now the code that works. The first thing you should do it to set the position of the banner, and then calling it. That was my problem. This code should work fine:
Turning on:
With this code you can turn on and off the banner as you want. This is useful to apps that can't show the banner all the time.
initAd must be in
viewDidLoad
I solved by it.