In short, I have obtained the source code from the Apple site on the iAdSuite page from the BasicAdBanner sample but my application doesn't even seem to call the method file to display the ad.
My application has several XIBs, a main window and a couple of others. I decided to create a new UIViewController to hold all the banner code and methods, rather than throw it in my main window. (which is where I want the ad - is this a problem? where should the code be?)
The delegate is set in the new view controller header, (<ADBannerViewDelegate>) the two views inside the XIB are linked, the properties (and member variables) are declared/set in the header and synthesized in the method, but there are no calls from within my primary view controller to it - yet the Apple one works and mine does not.
I am having a hard time understanding why theirs works - if I put any number of breakpoints into my method file it never hits - even if I add an import statement to the primary controller to tell it about the new one, still nothing.
I would be most grateful if anyone has any ideas, thanks in advance.
Nearly 100 views - does anyone have any ideas of something I may have missed, as that's what I believe/hope to be the solution.
In addition, the nib containing the programatically-defined iAd does have it's "ad" layer at the bottom of the file, but as I mentionned the code won't even break if I execute it. How does the app see it?
Thanks for this - definitely looks different to the code samples and couple of other tutorials I have followed so far, to no avail.
I think the main issue I will have in trying to get your code to work is that you use some code in the application delegate - my app already has one of these and is already connected to another class.
If you have any further suggestions, I would be more than grateful.
How do you put your banner onscreen ? Tell more about it, no one can help if you don't give details.
Well, originally I started out with Apple's iAdSuite sample code compilation. One of the projects inside is called BasicAdBanner. I copied their method and header file for their "TextViewController" and same for the nib.
My application delegate was also fed the "UIApplicationDelegate" reference as required. The nib file was linked within Interface Builder to the view and contentView outlets as required.
It compiles fine and runs fine - but I never see an ad, which should be positioned along the bottom of the screen. I have created a breakpoint inside one of the functions: (void)createADBannerView and it never gets hit. The apple one inside the project files will break.
I have included the import statement to the header inside my primary view controller - aside from this, I don't understand how the controller should just be expected to work, but simply that the Apple one does and mine does not.
At one point, before using the Apple material I did stumble across the following tutorial which worked for me. All of the code he explains (code blocks 1-6, and the two blocks above #1) I implemented into my primary view controller which worked. However, it was felt that this code should live inside it's own controller and from there onwards I got problems.
Did you move it into a separate viewController? How will you show this view controller with the ad over your main views ? It will be a blank one with the ad inside.
You are probably never really showing this view controller and its viewDidLoad never calls createADBannerView
You want it to show throughout all your views ? Or only in some specific areas
I currently have a separate view controller to hold the iAd code - method, header and nib. The nib only contains two referenced views. In total though, my current project is compromised of 5 nib files - I would have expected the iAd nib file to sit over most of the others though, or at least this is what I would like.
In total if the ads were shown on 3 of my 5 nib files, that would be really great, but for now just trying to get it to show at all is proving to be problematic.
So, does it sound like I need to try to specify inside which nib files the banner is to be shown, perhaps?
I currently have a separate view controller to hold the iAd code - method, header and nib. The nib only contains two referenced views. In total though, my current project is compromised of 5 nib files - I would have expected the iAd nib file to sit over most of the others though, or at least this is what I would like.
In total if the ads were shown on 3 of my 5 nib files, that would be really great, but for now just trying to get it to show at all is proving to be problematic.
So, does it sound like I need to try to specify inside which nib files the banner is to be shown, perhaps?
A view controller takes control of the whole screen with its own view. You could either add a banner view inside each of your View controllers that you want banners showing, or add it straight to your MainWindow xib and put your NavigationController/TabBarcontroller above it.
But you're right in the idea of extracting the banner stuff from inside your code... You could create a UIViewController category introducing methods to handle this for you, or a custom NSObject that attaches a banner on a given view.
Well I already have the banner methods inside a .m and .h file and it's own nib; the view inside the nib is connected to the correct outlets but is still never displayed.
Should I try to move these out to my main window nib for now just to try to get it working and remove the banner nib altogether, or stick to working with my current banner files, the header of which is already of the type:
What I mean is that if you keep a BannerViewController with the banner inside, you would only be able to see the banner, alone onscreen, on top of your app, which I guess is not what you want. A view controller can only be shown Fullscreen (either showing it modally or pushing it on a nav controller, which would only keep the navigation bar showing besides the banner), what you see inside your nib is what would be shown onscreen.
I would try to put it on the main window, and offset the rest of the interface when the banner is active.
To put it on my main window, I guess that is purely an interface nib change that needs to be made? And then move the banner header elements to the main window header, but leave the banner methods inside it's file and link to it from the main window header?
So anybody with any ideas or suggestions, or perhaps having problems getting iAd to function in a project of theirs with multiple view controllers?
Sorry I haven't had the time to look into this, did you make any progress at all ?
You could place your iAd on the MainWindow with an IBOutlet on your App Delegate to reference it later, then set the delegate to your custom class that will take care of moving it out of sight or using a different ad provider when iAds are not available
I am not entirely sure I understand what you mean, so will run over how I think I could implement your suggestion:
- Create an IBOutlet UIView property, store it in the application delegate method file... but then link it to a new view created inside which nib?
Currently, the program structure looks a little bit like this:
Main Window/view controller (m, h and nib)
Few other view controllers. (m, h and nib's) (this includes Apple's own BannerViewController files)
Application delegate. (m + h)
Assuming you want the banner visible throughout all views in your app, my suggestion it to place the ADBannerView in your MainWindow.xib , and link it to the App delegate IBOutlet you declared... Then you can manage from that one place the banner that is shown in every view of your app. Else your banner would be switching along with your views, I think I read that if you don't show an Ad for at least 30 seconds you lose ecpm.
Assuming you want the banner visible throughout all views in your app, my suggestion it to place the ADBannerView in your MainWindow.xib , and link it to the App delegate IBOutlet you declared... Then you can manage from that one place the banner that is shown in every view of your app. Else your banner would be switching along with your views, I think I read that if you don't show an Ad for at least 30 seconds you lose ecpm.
I place the ADBannerView in MainWindow.xib but some of my view controller are tableview controller. how do i resize these tableview as the iAds delegates are in AppDelegate. Thanks for any help....