iAd banner positioning trouble

I am trying to position an iAd banner at the top of the screen. When I use:

[lua]ads.show( “banner”, { x=0, y=0 } )[/lua]

the banner is in the correct position on an iPhone 5 running iOS 7.1.2, but is partway down the screen on an iPhone 6 running iOS 8.4 (52 points too low).

When I switch to:

[lua]ads.show( “banner”, { x=0, y=(display.contentHeight-display.actualContentHeight)/2 } )[/lua]

The banner is now off the top of the screen on the same iPhone 5.

Is anyone else having this problem? My understanding from reading through this tutorial is that 0,0 is supposed to work for automatically positioning the banner at the top:  https://coronalabs.com/blog/2014/07/15/tutorial-implementing-admob-v2/

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/06/admob.zip

I feel like I answer this about once a week.  My example shows how to show admob banners at top and bottom.

Perhaps I need to find a way to make my example more findable/searchable?

Sorry if that sounded flippant or exasperated.  I do answer this a lot and my sample works 100%.  I just wish I could find a way for folks to find it easily.

Note, in case there was confusion: iAd and Admob use same concepts for X/Y.

Tip: Neither will allow you to display offscreen.  If you choose a Y way above top, it will display at top.  Same for way below bottom.

Thanks for your help roaminggamer. I changed my x and y coordinates to what you suggested, and the ad is still off the top of the screen on my iPhone 5.

[lua]ads.show( “banner”, { x=display.screenOriginX, y=(display.contentHeight-display.actualContentHeight)/2 } )[/lua]

iad_banner_bug.png

I have also tried

[lua]ads.show( “banner”, { x=display.screenOriginX, y=-1000000 } ) [/lua]

which results in the ad being completely invisible, presumably off the top of the screen. My understanding was that you are right, and it is not supposed to allow you to position it offscreen, so is this a Corona bug?

@hgbrian,

Hi.  Was away this afternoon, back now.

  1. Couple of questions: Can you paste your config.lua contents here?  I’d like to see that.

  2.  Do you have this file in your folder? ‘Default-568h@2x.png’ (640x1136).  I’m not 100% sure, but it’s easy to test.

Meanwhile, let me dig through my code to see if I have a quick sample I can give you to test with.

-Ed

OK.  I put together a barebones sample that should work (fingers crossed).

  1. Please download this: http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/08/iads.zip

  2. Open main.lua and replace ‘ADIDGOESHERE’ with your ads ID (appId as per the docs) on line 8.

  3. Build it with the certificate you’re using for your game/app.

  4. Install and run it.

Assuming I didn’t goof up (fingers crossed again), it should work exactly as you want.

IF IT WORKS, compare my code and config.lua to yours.  Is there a fundamental difference?

IF IT DOES NOT WORK, I’d file a bug and use the demo I’m providing for the bug filing.

-Ed

PS - And If  you find an issue (i.e. I goofed up, please let me know)  However this code should work.

When I run your code the ads are off the top of the screen on both iPhone5 and 6. If I change the x and y coordinates to 0,0 the ads are in the right place on both devices. I also made a similar minimal project myself using my own config.lua and build.settings with the same results. 

If this were all I could just use 0,0 and be done, but frustratingly in my actual app 0,0 results in the ad being partway down the screen on the iPhone 6 (it shows up at y=0, right below the extra space added at the top by letterboxing around the 320x480 area). I am going to start adding things from my app to the minimal project to figure out what is causing the discrepancy, but if I understand correctly it is not supposed to be this hard to get the ad to stay at the top of the screen. The coordinates you use should work, since it is supposed to be impossible to place the ad off the top of the screen.

Here are screenshots of your code running on iPhone 5 & 6, plus my actual app running on iPhone 6 with the coordinates set to 0,0.

roaminggamer-iads.png roaminggamer-iphone6.png iphone6_iad_bug00.png

I was able to create a minimal project that exhibits the iphone 5/6 discrepancy by adding the rest of the loading screen files.

If i only include Default-568h@2x.png then the ad is off the top of the screen on both iPhone 5&6 when using your original coordinates (not 0,0), as it is in the code you put together.

When I also include Default-667h@2x.png then i get the behavior I describe above where:

  • 0,0 works on iPhone 5, but is partway down the screen on iPhone 6,

  • your coordinates work on iPhone 6, but are off the top of the screen on iPhone 5.

Link to the project.

First, thanks for the feedback on my demo app.  I was afraid I’d made a mistake in there and it sounds like you found one.

Second, this is sounding a lot like a bug.  I advise you to file one and post the Bug ID (mailed to you afterwards) here.

Meanwhile, I’ve downloaded your demo project and will give it a go as time permits today.  Note: I have neither an iPhone5 nor an iPhone6 in inventory right now, but I have a local intern with the prior, so I’ll get him to do some testing after our next meeting.

Again, I wouldn’t delay filing that bug and then posting the number here.  That way it gets in the queue earliest, and Rob and the crew can see it.

-Ed

PS - I just want to say, you’ve done a excellent job of trying to work this out and I encourage other readers to take note of your effort and steps.

Thanks so much for your help. It would have taken me A LOT longer to get to the root of the problem if you hadn’t mentioned that the loading screen files might be involved. 

I submitted a bug report and will update with the Bug ID when they get back to me.

I submitted this over still weeks ago and still haven’t received a bug ID or any confirmation that I submitted it. Is it normal for it to take so long to get confirmation?

Hi @hgbrian,

The auto-responder should provide you with a bug case number fairly quickly. Are you sure it didn’t get nabbed by an e-mail spam filter or something?

Brent

I checked my spam folder and I also checked my alternate email address. I then tried resubmitting it about 15 min ago in case I had made a mistake the first time and still nothing. I did get to the page that says “thank you for your submission,” just no email.

I am getting emails when people reply to this thread though.

Hi @hgbrian,

I can’t locate the bug in our database. Can you please try once more to submit it (submit another report) under the e-mail that is associated with this same forum e-mail account (just in case you have an alternate Corona e-mail for development or something like that).

Thanks,

Brent

I tried submitting it from Safari instead of Chrome about five minutes ago. Still no email.

Filed bug case #42600

Rob

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/06/admob.zip