I'm near completion with an app and I'm starting to add ad's to it. For adMob I have the following code in my viewdidLoad method:
bannerAd.adUnitID = "...."
bannerAd.rootViewController = self
bannerAd.load(GADRequest())
This is currently only on the first view controller that pops up. The ad is on the bottom of a landscape only app. My question is is okay to add this to all of my view Controllers that you can segue too?
I'm not exactly sure if I need to close out the ad when I leave view controllers, or if this is handled automatically. It would be simple for me to add this to all view controllers, but I'm not sure if this creates more ad requests as the user switches from view to view, or how it works...
I'm new to app development and am getting ready to roll out my first app. I would appreciate any help and I thank you in advance!!!!
Related
Currently have I implemented iAd and AdMob to each and every view controller in my Xcode project. I have about 6 view controllers and every time I switch back and forth between them one adbanner disappear and another appears. I want to make only one single adbanner for all view controllers. So even though its a transition between two view controllers, only one adbanner will be visible and it will not disappear and appear again.
But I also need to reach it from each class. So I can show it and hide it when I want to.
I would appreciate a ditailed step-by-step instruction.
INFO:
I am using storyboard. I am developing for iOS 6.0 and higher. I am using navigation controller.
So pass the banner view from one view controller to the next just as you'd pass any data. Install the view in the view hierarchy in each controller's -viewWillAppear method. You can pass the view between controllers in your -prepareForSegue method. If you're not sure how to pass objects between view controllers, search here -- here are many questions covering exactly that topic.
I want to add many ADBanners in my application. What's preferred: share one banner in all view controllers, or create an ADBanner for each viewController?
it does not really matter if you want to create a ad banner for each view.
but you need to keep in mind the best practices from documentation:
Banner View Best Practices
Only create a banner view when you intend to display it to the user. Otherwise, it may cycle through ads and deplete the list of available advertising for your application.
If the user navigates from a screen of content with a banner view to a screen that does not have a banner view, and you expect them to be on that screen for a long period of time, remove the banner view from the view hierarchy, set its delegate to nil and release it before transitioning to the new screen of content. More generally, avoid keeping a banner view around when it is invisible to the user.
When your application creates a banner view, there is a delay before the view can actually display an advertisement. If you intend to use that banner view on a screen of content that is only visible to the user for a short period of time, the banner may not have enough time to download an advertisement before a user finishes interacting with that screen of content. Instead, your application should create a single banner view and use it throughout your user interface. As the user navigates around your application, your application moves the banner view onto any screen that is expected to display a banner. The iAdSuite sample demonstrates how to implement this technique.
When an ad transitions to a rich media experience, iAd consumes additional memory so that it can display an interactive ad to the user. This memory comes from your application’s available memory. Your application must scale back its activities to allow the ad to run smoothly and respond quickly to low-memory conditions by releasing large objects that can be easily recreated after the user finishes interacting with the ad.
I prefer to create a singleton class for ads and just call the same view into each view when displayed. That way you don't have to call for a new advert on each view.
I've posted singleton code for adwhirl here is it a good practice to delete the AdBannerView on viewWillDisappear and add it back on viewWillAppear? which you should be able to ammend for just iAd
In our app, Admob's Ads are displayed on several View Controllers (VCs). And each VC loads it own ad. This leads to unnecessary network usage for the user.
To counter this, can we achieve something like... loading the ad when App Launches & mirroring it on VCs... this way it could have at least two benefits:
user network would be efficiently used
there would be no delay in displaying ad when user switches views
Thanks
You wouldn't mirror the content, you could just pass the UIView between the UIViewControllers.
Put the admob code somewhere common (perhaps your app delegate) so it's only in one place. When you show a new uiviewcontroller, in it's viewWillAppear view ask the app delegate for the advert view.
I want to ask something about iAd's.
My main view controller include ADBannerViewDelegate and shows iAd banner correctly.
But I need to show iAd in all views
so should I transfer the same banner to all my view?
Or it is better to create a new iAd banner in IB for each view?
like here:
TempsReel *tempsReel = [[TempsReel alloc]initWithNibName:#"TempsReel" withBanner:adView];
[self.navigationController pushViewController:tempsReel animated:YES];
[tempsReel release];
Thanks for your help.
A UITabBarController or UINavigationController is by default going to take up the entire screen. What I did in my last app was just leave an iAd sized gap in my xibs for the view controllers inside the tab bar controller or nav controller.
In my application delegate, I create the iAd banner view and add it directly to the tab bar or nav controller's view.
iAdView.frame = CGRectMake(...);
[tabBarController.view addSubview:iAdView];
Then it'll be there all the time, regardless of what tab you are on or what level in the nav stack you are.
An additional note... I suggest checking out https://www.adwhirl.com/ They provide an easy to use system that will allow you to include ads from many different sources including iAd. Apple only fills like 10% of ad requests, so you are missing out on revenue for the remaining 90%.
You're not supposed to be showing more than one iAd banner at a time, or an iAd banner on screen with any other ad from another agency for that matter.
For apps with UITabBarControllers or UINavigationController as their main setup, I believe the iAd guidelines give advice on what you should do to keep a single ad banner onscreen at all times.
I would look into adding iAds either UIWindow or a UIView, either at the bottom or top, and then putting the tab bar or nav controller in the remainder of the screen.
I haven't done this myself but this is where I would start. Keep in mind that you won't have a banner displayed all the time so whatever else you have onscreen needs to resize appropriately.
If you have a main view that's viewed the majority of the time, I would just put a banner view there and forget about the rest if this seems like too much work.
Hope this helps.
I want to put an ad on my iPhone application.
And I'm using TabBar to separate some features.
Here's my question. I just want to put ONE AD which always should be displayed no matter what user select & switch between views by pressing tab-bar. I want that ad right above the tab-bar.
I don't want to put ad on every view nor refreshed every time user changes view.
Can somebody give me some idea??
thanks.
Your TabBarControllers view was added to the application window at some point. This is usually in your applicationDidFinishLaunching method if doing it by code, otherwise it is done through Interface Builder. Either way, if you want to add a view globally, do it at the end of applicationDidFinishLaunching and add it as a subview of the application window, not to any individual view controller. Just ensure you are adding it after the tab bar controller as otherwise it will be covered up.