In iOS 7, ADBannerView no longer needs to be created manually. Instead, they can be requested with a simple self.canDisplayBannerAds = YES;
Now, I cannot set my View Controller as the banner delegate because there is no banner for me to access (to my knowledge).
I need to know when the banner is tapped and when that action is dismissed so I can properly pause/start my Sprite Kit game.
How am I supposed to have these delegate methods called so I can properly respond to the user's actions?
AFAIK, there is nothing in the UIView Controller iAD Additions that explains how to set the delegate for the banners.
Do I need to create the banners manually, or is there a way to achieve this while still using the newer API's?
Unfortunately, if you want to use the delegate methods, you will need to set up your iAd Banner manually. Even if you make your vc the delegate, by just using self.canDisplayBannerAds = YES, will not call the methods you need. In my sprite kit game, I made all the banners manually so I could take care of pausing the game and going to the background. Making them give you the control you are looking for. Good luck.
Related
iOS 9.3, Xcode 7.3, ARC enabled.
I am migrating away from iAd, and I have some general questions regarding best design patterns and how to properly use the Google Mobile Ads framework for banner style ads.
How do you control presentation on ad load and load failure?
My typical approach is to start with the banner view hidden, detect when the ad is loaded, then either animate the banner view in from the top or bottom, or fade in from a stand-in image.
I noticed that GADBannerView class, does not have some of the more convenient properties of an iAd banner, such as isLoaded.
a) Right now I take advantage of the two methods - (void)adViewDidReceiveAd:(GADBannerView *)bannerView and - (void)adView:(GADBannerView *)bannerView didFailToReceiveAdWithError:(GADRequestError *)error, set an instance variable bool for the view controller when either method gets a message, then use that variable for any additional UI changes else where. Is this a good design practice?
b) "deleted", animation works.
c) When the ad fails to load, what happens to the banner view? I notice that its alpha property is still 1.0 and that it is not hidden. In a production environment when an AdMob ad fails to load, is the banner clear? Or does it have a generic stand-in image? In other words, am I going to have to slide in an image to balance the view without the banner view there?
I've read from the basic AdMob tutorial that it doesn't really matter where the banner is, it can be in multiple view controllers, the framework will manage how these multiple banners will be filled. Could someone confirm this behavior? Say, I have two view controllers and I have two different banner views, I don't have to manage the ads? All I have to do is provide the banner view real estate?
Generally speaking, if I used to have iAd for ads and also in-app. purchases through iTunes, then what is the modern day trend? Am I supposed to have ads through AdMob and keep in-app. purchases as they are through Apple? Is that what people are doing now?
Thanks in advance for your answers. I know this maybe too general, but I really want some sort of a fundamental understanding where to head, before I submit anything to Apple.
--
Here is the code for animation I am using:
- (void)adViewDidReceiveAd:(GADBannerView *)bannerView
{
bannerDidLoad = true;
[UIView animateWithDuration:1.0 animations:^{
bannerView.alpha = 1.0;
bannerView.frame = CGRectMake(bannerView.frame.origin.x, bannerView.frame.size.height, bannerView.frame.size.width, bannerView.frame.size.height);
} completion:^(BOOL finished) {
nil;
}];
}
You should really narrow your question down. It's kind of vague. Anyways, yes GADBannerView's will be clear if they fail to receive an ad. Using the delegate methods to know what state the GADBannerView is in is the standard. Animating the alpha property should not be an issue. Not really sure what that last question is asking. You can use any ad network you'd like. If you're using in app purchases already just continue using them and remove the GADBannerView instead of the ADBannerView.
Can you preload admob DFPRequest on iOS? I know you can for interstitials, but was wondering about DFPBannerView
Create one GADBannerView and one request inapplicationDidFinishLaunching, listen to the GADBannerView's delegate method to know when it's loaded, and then present it on any view you desire. applicationDidFinishLaunching would be the earliest you could make your request. Check this example using an ADBannerView and Swift. The implementation would be the same.
No, you can't do it for banners. Once you call LoadAd() for a banner ad unit, your banner ad starts loading and refreshes after a set interval (what you've set on the dashboard, or the default), if any.
There is no way to preload admob banner ads like interstitial.
I want to implement iAds to my UITabBar application, and I discovered that if I use the canDisplayBannerAds property on each of my ViewControllers then the ads are displayed/hidden accordingly, resizing the view perfectly and it's so easy to implement (no ADBannerView added on Storyboard), but easy is almost never good.
Is there anything wrong with this? Do I need to add an ADBannerView either by code/storyboard?
There is no need to create an AdBannerView in code or the storyboard. I'm using canDisplayBannerAds in my apps and it is working fine. Apple does everything for you and you mustn't take care about memory leaks, rendering issues, error handling, ...
Is there anything wrong with this?
No, canDisplayBannerAds is easy to implement and requires no effort to manage. I usually suggest using canDisplayBannerAds when someone is placing advertisements into their application for the first time. It gets them familiar with advertisements and iAd.
Do I need to add an ADBannerView either by code/storyboard?
No, using canDisplayBannerAds does not require you to implement an ADBannerView. The moment you need an ADBannerView you'll know it. For example, you want to use another ad network for when iAd fails to receive an ad. Using canDisplayBannerAds you're not able to do this. You need the delegate methods you would inheret from using your own ADBannerView.
I'm showing interstitials by using destinationVC.interstitialPresentationPolicy = ADInterstitialPresentationPolicy.Automatic before I actually show the destintion view controller.
How am I supposed to detect if an interstitial loaded? I need to know so I can know if I should reset a timer that let's me show interstitials every few minutes.
It's weird - even with 100% fill rate enabled in my developer settings, my interstitial doesn't always show...
I tried implementing ADInterstitialDelegate but it seems interstitialDidLoad doesn't actually execute?
For the fillrate, are you talking about test ads or live ads? iAd has a very low live ads fill rate and is even not supported at all in many countries...
For the delegate, did you assign the delegate e.g.
self.interstitial.delegate = self;
Assign it and do an NSLog for example in the delegate methods like in interstitialDidLoad to test if it s called...
P.S. A timer to fire ads isn t really a good idea... Ads should be fired after an action by a user, at a specific time regarding the app lifecycle / usage and should not interrupt, what would obviously happen if you use a timer...
I've set up iAd in my iOS app. When I saw the fill rate, it is very low. So I would like to insert an AdMob(an other ad provider) banner when iAd banner didFailToReceiveAdWithError.
The process goes well but I do not find the way to stop iAd to call request. So if iAd bannerViewDidLoadAd, my app display both banners.
Is there any way to stop iAd request ?
Set the iAd delegate to nil and also set the iAd banner to nil. Setting the delegate to nil, you will not receive callback anymore.
A cleaner way to handle it would be to use a mediator like Admob to serve both kinds of ads. When your first option fails to deliver it handles the fallback to your 2nd and 3rd, 4th, 5th options.