Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-20-2010, 05:04 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default iAd Issue

Hi all,

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.

https://developer.apple.com/library/...ion/Intro.html

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.
krydev is offline   Reply With Quote
Old 09-21-2010, 03:33 AM   #2 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

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?
krydev is offline   Reply With Quote
Old 09-22-2010, 04:30 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

Bump.
krydev is offline   Reply With Quote
Old 09-23-2010, 02:17 AM   #4 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

Bump.

Surely I'm not the only person to use iAds in their app?
krydev is offline   Reply With Quote
Old 09-24-2010, 10:23 AM   #5 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

Bump.
krydev is offline   Reply With Quote
Old 09-24-2010, 04:01 PM   #6 (permalink)
Banned
 
Join Date: May 2010
Location: New Jersey
Posts: 595
Chessin is on a distinguished road
Send a message via AIM to Chessin
Default

Quote:
Originally Posted by krydev View Post
Bump.
I made this video. Check it out, hopefully it will work for you!

YouTube - Xcode Tutorial 2 - Putting iAd into your App (The Apple Approved Way)
Chessin is offline   Reply With Quote
Old 09-27-2010, 03:26 AM   #7 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

Quote:
Originally Posted by Chessin View Post
I made this video. Check it out, hopefully it will work for you!

YouTube - Xcode Tutorial 2 - Putting iAd into your App (The Apple Approved Way)
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.

Thanks in advance.
krydev is offline   Reply With Quote
Old 09-27-2010, 07:46 AM   #8 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

How do you put your banner onscreen ? Tell more about it, no one can help if you don't give details.
nobre84 is offline   Reply With Quote
Old 09-27-2010, 08:33 AM   #9 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

Quote:
Originally Posted by nobre84 View Post
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.

How To Integrate iAd into Your iPhone App | Ray Wenderlich
krydev is offline   Reply With Quote
Old 09-27-2010, 08:41 AM   #10 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

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
nobre84 is offline   Reply With Quote
Old 09-27-2010, 10:06 AM   #11 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

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?
krydev is offline   Reply With Quote
Old 09-27-2010, 11:56 AM   #12 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

Quote:
Originally Posted by krydev View Post
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.
nobre84 is offline   Reply With Quote
Old 09-28-2010, 03:06 AM   #13 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

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:

@interface BannerViewController : UIViewController <ADBannerViewDelegate>
krydev is offline   Reply With Quote
Old 09-28-2010, 07:38 AM   #14 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

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.
nobre84 is offline   Reply With Quote
Old 09-28-2010, 08:33 AM   #15 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

That sounds correct, yes.

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?

Thanks again for your help so far.
krydev is offline   Reply With Quote
Old 09-30-2010, 09:26 AM   #16 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

Bump.
krydev is offline   Reply With Quote
Old 10-01-2010, 11:04 AM   #17 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

Another bump.
krydev is offline   Reply With Quote
Old 10-07-2010, 09:53 AM   #18 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

So anybody with any ideas or suggestions, or perhaps having problems getting iAd to function in a project of theirs with multiple view controllers?
krydev is offline   Reply With Quote
Old 10-11-2010, 07:49 AM   #19 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

Quote:
Originally Posted by krydev View Post
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
nobre84 is offline   Reply With Quote
Old 10-11-2010, 09:21 AM   #20 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 25
krydev is on a distinguished road
Default

Hey, thanks for the reply.

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)

Thanks again for your help thus far.
krydev is offline   Reply With Quote
Old 10-11-2010, 10:05 AM   #21 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

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.
nobre84 is offline   Reply With Quote
Old 04-12-2011, 04:42 AM   #22 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
dexertmoon is on a distinguished road
Default tableview

Quote:
Originally Posted by nobre84 View Post
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....
dexertmoon is offline   Reply With Quote
Reply

Bookmarks

Tags
iad, iphone, uiviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 313
14 members and 299 guests
2ndSegment, cayladv57, cgokey, dermotos, djohnson, Domele, Hamad, linkmx, markuschow, pungs, Sloshmonster, teebee74, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:00 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0