Should I only use canDisplayBannerAds. No ADBannerViews? - ios

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.

Related

Is it possible to detect all calls of viewDidAppear in one spot?

I want to trigger some analytics code every time a user in my iOS app moves to a new screen.
Is there a way to detect every call to viewDidAppear, or do I need to implement this in every ViewController ?
Yes, lots of the analytics suppliers frameworks offer this feature. Generally they're implemented with swizzling, so they replace the UIViewController implementation to capture the analytics and then call the stock implementation. As all your view controllers should call super then their code will be run.
It's also possible that you could create a superclass for all your view controllers but this is harder to fit into most apps.
I did something similar to one of my apps with google analytics. At that time I had to subclass my controllers from GAITrackedViewController. That pretty much did it. I added the self.screenName = #"some screen name"; on viewDidAppear method just to know where the user was on my GA Dashboard.
It was explained on the GA docs, so it won't be hard to find.

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

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

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.

IOS initial view controller based on condition retrieved from database

An iOS app I'm creating shows a setup screen upon first launch which requires data to be written to the database.
Upon launch, I need to access this value form the database.
If it is set, launch main view controller
Else show setup view controller.
As far as I'm aware theres two ways I can do this, programmatically setting it from the AppDelegate or using an initial View Controller as a splash screen and performing the look up and segue there.
What would be the best way to approach this? Is it wrong to do a database lookup in didFinishLaunchingWithOptions?
Using a splash screen is probably the better option as it provides better scope for modification in the future and allows you to update the user on progress. It is fine for the app delegate to run logic to determine how the app starts but you should endeavour to keep the app delegate minimal and focussed.
I very much doubt that you would get this approved (if your goal is the App Store). Your app delegate needs to create a window, and set a rootViewController to that window before it returns YES in appFinishLaunching:
You simply do not have enough time to check with a server before creating the first viewController and you'll be creating poor interface if you try. I suggest the first ViewController will need to be informing the user that it is checking with the server with an activityIndicator or something. The best :)

Receiving Delegate Methods for iAd Banners iOS 7

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.

Resources