iOS8 App with iAds: Can each view controller enable canDisplayBannerAds? - ios

I am creating an iOS8+ application and am ready to add iAd to it. At this time, I've set the following in viewDidLoad() for each UIViewController in my application:
self.canDisplayBannerAds = true
Everything seems to be working properly... Ads are appearing when I switch between views. Is this the proper way to enable iAd with multiple views on iOS8 and newer releases?
I have not found any documentation that says how to use canDisplayBannerAds with multiple view controllers. I found a lot of postings for earlier releases of iOS where the developer had to implement iAd on his/her own, and only create a singleton. Anyway, I hope that someone can verify that what I have done is correct and will work properly when the app goes to the store.
Thank you for your time and help,
Mike

Related

How to stop showing AdMob banner ad correctly?

I am building an app which will display AdMob banner ad, and when user successfully purchased an IAP item, the banner ad will never show up again, and the screen area originally occupied by the banner ad will be used by the app real functions.
The question is how to dismiss the bannerView or does not init it on the next launch up? And how to insure AdMob Sdk will never refresh the ad content in the background?
I think we cannot just hide the bannerView with just a statement:
bannerView.isHidden = true
And, as we know, AdMob SDK use IDFA. But Apple will deny an app which use IDFA but not showing Ads.
Google has guides on how to show up ads, but I cannot find information about how to stop showing ads from Google.
How to get this problem out?
The question is how to dismiss the bannerView or does not init it on
the next launch up? And how to insure AdMob Sdk will never refresh the
ad content in the background?
There are multiple ways to do this. One way I can think of is to add multiple targets in your Xcode project.
And the easier way, the more practical way - at least for me, is to prevent the requests for ads through GADRequest().
You can even do this even in AppDelegate, when setting Ids to your SDK.
That's it. You may also set nil to the delegate property of your bannerView.
And like what you've mentioned, just hide the bannerView's container, and everything should be perfect. I've worked on lots of applications with Admob, and I believe there should be no problem doing this approach.

Should I only use canDisplayBannerAds. No ADBannerViews?

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.

Does canDisplayBannerAds only use a single instance of an iAd Banner?

I am creating an iOS8 application and started to implement iAd's Banner in code, but yesterday I discovered that I can use the canDisplayBannerAds property. I enabled it on each of the views in my application, and it is working. Previously, when I was implementing it with my own code, there was a lot of discussion about the importance of using a singleton of the ADBannerView. Does canDisplayBannerAds use a singleton, or is it violating what I had read about the importance of using a singleton? Does it really matter from a performance, advertising, and Apple Store perspective?
Thank you for your comments and feedback,
Mike
No, it uses a new one each time. I ran into that problem when first using iAd. Each vc had canDisplay... And the ads got all messed up. In fact they didn't even show up in the App Store version. Best to use either the singleton method or something similar that reuses the iAd. I myself use the app delegate. All my apps use that and I have not run into any problems at all. Good luck!
EDIT#1
Here is a link to a blog post I wrote using iAd with the app delegate. It is written in Objective-C but at least you will get the general idea. I basically create an iAd banner in the app delegate and then use that one in every vc you need.

Working with the AppDelegate file to create a single shared iAd banner in Swift

I was trying to follow the steps here to create a shared iAd banner for all the view controllers in my application. I couldn't understand how do I do this in the app delegate since I've never touched the app delegate before.
The instructions were:
Has anyone worked with this before?

How to load ADInterstitialAd only when required in iOS?

I would like to show interstitial ads in my iOS application for some specified time interval.
Also, I do not want to disturb the User Interaction. I would like to show this Interstitial Ad when user tries to navigate from the scree/some other action.
But, I don't see any method/call in iOS that would load the InterstitialAd when required.
Also, [interstitialAdObj presentFromViewController] is also deprecated in iOS 7.
My question is, what is the another way to show/present the interstitial ads only when required?
This one works for me in iOS 7. Found in the ADInterstitialAdDelegate
-(BOOL)presentInView:(UIView *)containerView;
Also
-(BOOL)requestInterstitialAdPresentation NS_AVAILABLE_IOS(7_0);
I hope that helps you.

Resources