iAds not clickable - anyone else having this issue?

Hey,

Can one if you guys post a complete project with the build.settings, config.lua, and main.lua where the iAds banner shows up at the top of the screen?  I am unable to recreate it with my test case.  Also please post the device you’re running it on and the build of Corona you’re using.  Thanks.

Thanks Danny.  I’m isolating it into a simple complete project now and will post something shortly.

  • Andrew

Hi Danny,

Here is a simple project exhibiting the bug.  Through experimentation, I was actually able to find that the bug is a bit more interesting.  Specifically, it appears that, on the first banner display, the ad is aligned so that the top is equal to y value provided in ads.show().  Subsequent displays align the ad so that the bottom is equal to the y value provided.

build.settings:

settings = { orientation = { default = "portrait", content = "portrait", supported = { "portrait" }, }, plugins = { ["CoronaProvider.ads.iads"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone = true } } } }

main.lua

-- Load the ads module local ads = require("ads") -- Display a red background so it's easier to see the display area edges on an iPhone 5 if we're not using a tall launch image local bkg = display.newRect(0,0,display.contentWidth,display.contentHeight) bkg:setFillColor(64,0,0) -- Initialize iAds with a callback that dumps the ad events to the console local callback = function(event) for k,v in pairs(event) do print(k,v) end end ads.init( "iads", "com.company.appname", callback ) -- Experiment with different values for y local y = display.contentHeight -- Create a small circle centered at this y so we can compare to where the banner is displayed display.newCircle(display.contentWidth/2, y, 20) local showBanner = function() print("Attempting to display banner") ads.show( "banner", { x=0, y=y } ) end -- Set the provider to iAds ads:setCurrentProvider("iads") -- Show the first banner showBanner() -- Every 10 seconds, hide the banner and display it again timer.performWithDelay(10000, function() print("Hiding banner") ads.hide() timer.performWithDelay(1000, function() showBanner() end) end, -1 )

There is no need for a config.lua to exhibit the bug.

I built this project using Daily Build 1227 and ran it on an iPhone 5 running iOS 7.0.4.

If you run the code exactly as above (just replace the bundleID in ads.init()), you’ll see the first banner display on top and subsequent banners display on the bottom.  If you change it so that y=300 or 500, you’ll see that the first banner is aligned with the top at y=300 or 500, and subsequent banners are aligned with the bottom at y=300 or 500.

Let me know if you’re able to reproduce the bug using this code.

Thanks.

  • Andrew

Yes I can reproduce this issue thanks.  While working on this you can try using Mas1’s hack to work around the issue.

Hi,

A fix has been pushed up.  Please rebuild your applications and confirm the fix works for your case.  Thanks.

Thanks Danny.

When I now build the sample project that I posted, the ad does display in the same place the first time as on all subsequent displays, which is a step forward.

However, the ad is now being displayed so that the bottom aligns with the y value specified.  That’s consistent with the previous behavior, but I want to point out that it’s contrary to the API specification at http://docs.coronalabs.com/api/library/ads/show.html, which says the y value should specify the top of the banner.

Actually, if y<bannerHeight, then the banner does display with the top at y.  But if y>bannerHeight, it will display with the bottom at y.  Is this the intended behavior?

Thanks.

  • Andrew

You’re correct they should align with the top of the ad and this has been changed.

Hi Danny,

Yes, I tested it again just now, and everything is looking good!  The banner is positioned where I expect it to be, and it’s positioned there every time.  I tested on an iPhone 4, iPad 3, and iPhone 5.

Thanks for turning this around.  I, and surely everyone else on this thread, appreciate it!

  • Andrew

It’s now very confusing about placing the ad at the bottom of the screen.

From dchan’s earlier post,

You’re correct they should align with the top of the ad and this has been changed.

Does it mean the ads should all align with the top now?

However, from my testing, it’s still not consistent, please see the following results for the inconsistency: (I am using the latest daily build - CoronaSDK 2013.2100 and my config.lua is 320x480, letterbox)

(1) If y = display.contentHeight, iAd shows at the bottom for iPad (because iPad’s display.screenOriginalY = 0), but for iPhone 5S, iAd shows above the bottom. For admob, it behaves the same as iAd.

(2) If y = display.contentHeight - display.screenOriginalY, iPad is fine for both iAd & admob (again, I think it’s because display.screenOriginal is 0 for iPad). For iPhone 5S, iAd shows at the exact bottom, which is good. But for admob, the ad shows above the bottom for iPhone 5S. 

Besides, admob shows below the bottom for Galaxy Tab 3. (part of the top area of admob ad shows up)

(3) If y = display.contentHeight - display.screenOriginalY * 2 , admob shows correctly at the bottom for iPhone 5S, but below the bottom for Galaxy Tab 3. For Galaxy Tab 3, in order to show at the exact bottom, I found y = display.contentHeight - display.screenOriginalY  * 2 - 63  would do. (I don’t know how to get this number, 63. I started with 50 & 66, and adjusted one pixel at at a time to get 63.) BTW, display.screenOriginalY for Galaxy Tab 3 is -16.

The conclusions:

(1) For iAd, it still looks like it’s “bottom-aligning”, is this final?

(2) For admob, the y value behaves differently than iAd, why is that? is this intended behavior? If yes, what’s the rule?

(3) For admob, iOS device & Android device seem to behave differently? How to correctly calculate the y value to place admob at the exact bottom for both iOS & Android devices?

Please someone shed some light on this. I am about to release a new version with iAd & admob before iTunes closes for the holidays. It’s a total mess right now.  :unsure:  Thanks.