-
Create some sample code of your issues and submit it as a bug.
-
Post bug number.
I submitted a bug, # 33780. Here is the simple code sample I submitted that crashes for me on the simulator. I’m a Pro user using daily 2347 on a Mac. The error message is “…attempt to call field ‘load’ (a nil value)”
main.lua:
-- Test admob crash on simulator local ads = require "ads" adUnitID = "ca-app-pub-1111111111111111111111111111" local function admobListener(event) for k,v in pairs(event) do print("admob event k,v: ",k,v) end end ads.init( "admob", adUnitID , admobListener ) ads.load("interstitial", { appId = adUnitID, testMode = false })
And build.settings:
-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs",}, -- For Admob plugin }, orientation = { default = "portrait", supported = { "portrait", } }, iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend --[[ -- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXXXXXXX", -- example scheme for facebook "coronasdkapp", -- example second scheme } } } --]] } }, --[[-- Android permissions androidPermissions = { "android.permission.INTERNET", },]]-- }
@dchan can you please bump up the priority on this? Here is another thread opened today by someone else with the same crash with ads.load():
http://forums.coronalabs.com/topic/49113-admob-v2-crashing-on-adsload-really-strangeideas-please/
Wished i had searched the forums before upgrading.
Although when they say its working etc why would I ?
I only upgraded to pro for admobV2 ! I couldnt waut until the next public release and now it dosnt work…ridiculous.
I am considering asking for my money back ,it can be done on their 5 day policy.
Has a member of Corona spoken on the subject yet ?
This is very disappointing indeed
Ok , so I submitted a bug report but accidentley placed my ads.load() etc before my init…
Must remember to check after stripping everything out.
resubmitted.
However it seems to me that the engineers are not aware of this or rather some are not.
I appreciate them looking at the exact issue but surely common sense should have told them; oh hang on a minute this is that bug everyone in the forums talking about?
fingers crossed they come up with something.
And this should be fixed…
Ok,
I am feeling little bit overpowered here.
I am just trying to get something sorted, although I am young I do feel very overpowered by Corona.
Tom has stated and i quote
"
I did run your sample with the correct placement of the code and it runs fine on a Nexus 7 so I don’t see the crash you’re talking about. It did correctly show an ad. We don’t have any other crash reports for Admob.
"
We don’t have any other crash reports for Admob" really? what about this thread ?
I am going to leave this for a while now, I just dont appreciate spending hundreds of dollars to have something not work when it is supposed too.
I have posted my code here if anyone wants to try it:
https://drive.google.com/file/d/0B9IPnsjHf9UEdllzSnNCckQ1dTQ/edit?usp=sharing
thanks
ps. i will bow down gracefully and apologise totally if I am wrong most sincerely.
ads.load() now works for me on iOS devices (though still busted on simulator).
For those experiencing a crash with ads.load() in the Simulator, you can use the following code.
The Corona Simulator library in missing a stub for the new load() function, which is why it’s crashing.
The following code is a workaround.
local ads = require("ads") ads.init("admob", "your-appID-here" [, optional\_listener]) ads.oldload = ads.load ads.load = function(...) if (type(ads.oldload) == "function") then ads.oldload(unpack(arg)) else local msg = "ads.load() not available" if (system.getInfo("environment") == "simulator") then print(msg.." in the Simulator") else print(msg) end end end
Weird. Now it’s not working when I try to build for iOS. I’m getting this “Unexpected build error” in my Sublime build console when I try to build for device:
/Users/stephenlewis/Desktop/BakeryBatch.app/.build/libtemplate/Builder.lua:310: <error>{“status”:256,“message”:“ld: library not found for -lads-admob\nclang: error: linker command failed with exit code 1 (use -v to see invocation)”}</error>
stack traceback:
C: in function ‘assert’
/Users/stephenlewis/Desktop/BakeryBatch.app/.build/libtemplate/Builder.lua:310: in function ‘checkError’
/Users/stephenlewis/Desktop/BakeryBatch.app/.build/libtemplate/Builder.lua:333: in function ‘build’
?: in function ‘buildExe’
?: in function <?:695>
EDIT: CL fixed this.
I have asked so many times but no answer,
(1) Why do we need to call ads.load()? (And I have to call it in system suspend event again in order to call ads.load consistently, what a weird implementation!) Android doesn’t need ads.load() to be called, why is the difference? And this method is brought by Corona users not from official document, why is it trustworthy?
(2) Where is the formal documentation?
(3) Why is there no more callbacks in the admob listener? (both successful or failure case, no more callback!)
Corona, could you answer these questions first? I really don’t care if ads.load() crashes in Simulator if these questions can not be answered first because I am really having doubt in using V2 and I strongly believe V2 has to be improved a lot!!!
Android doesn’t need ads.load() to be called
Really? Where did you get that information?
From my previous testing that I didn’t call ads.load(), Android can show the full screen ad.
And I just tested it again, the same result, Android can play full-screen ad without calling ads.load()
I don’t know how you get to know the workaround by calling ads.load() for iOS devices to show full-screen ad.
Why can’t Corona come up & answer these questions?
(1) Where is the formal documentation?
(2) Is ads.load() necessary for iOS? isn’t this just pre-load? Why is it necessary?
(3) In iOS, even I call ads.show() without ads.load, why is there no error (no callbacks)? It’s just plainly silent, which is also wrong!
(4) Even if ads.load() is called in iOS and the full-screen show successfully, why is there no more callback?
(5) Android can show the full-screen ad without ads.load & there is callback. Why does Android behave differently than iOS?
(6) Why can Corona consistently avoid answering these questions?
If you call ads.show() (without caching the ad) there’s no guarantee that the ad will show immediately. It might take several seconds for it to show up, which isn’t acceptable in many cases. That’s why ads.load() exists.
The reason why ads.load() is necessary for interstitials, is because of performance reasons. It will attempt to cache an ad. When you come to a point in your app where you want to display an ad you call ads.isLoaded() to see if an ad is cached. If it returns true call ads.show() otherwise don’t.
The caching will behave the same for both Android and iOS.
You just answered question (2), but the major problem is the inconsistency & the current way is not making sense. If I don’t like to preload, it’s my business, why is it necessary? Why Android doesn’t need to? Even if there is no “guarantee”, why is there no callback to indicate any error or success?
Please just let Corona answer these questions.
Joe, I’m trying to get answers for you but I have no internet and limited access from my phone.
The issue with .load() not working in the sim is an oversite. It should be fixed soon. I know engineering was working on it today. But in the mean time you can wrap an if statement around it until it gets in.
The plugin is documented on its plugin page. I can’t copy and paste the URL for you at the moment.
Ingemar has addressed the how to use more eloquently than I can.
As for the callbacks in trying to get an answer for that.
Rob
Joe, I’m trying to get answers for you but I have no internet and limited access from my phone.
The issue with .load() not working in the sim is an oversite. It should be fixed soon. I know engineering was working on it today. But in the mean time you can wrap an if statement around it until it gets in.
The plugin is documented on its plugin page. I can’t copy and paste the URL for you at the moment.
Ingemar has addressed the how to use more eloquently than I can.
As for the callbacks in trying to get an answer for that.
Rob
Hi Rob
I know there are documentations for V2, I do have read them, but I am asking the formal documentation to note why ads.load() is necessary for iOS but not for Android, why is there no callback, etc. The current documentation only describes simply how each function is used.
You should ask your engineering about the callback and why ads.load() is a must for iOS but not for Android.
I really need the callback event for ads since I show ads during a transition and need to know when the user closes the ad to complete the transition. But on iOS, without the ad event callbacks, my app just gets stuck waiting for the callback that never comes. This works fine and more or less the same for the other ad plugins I’m using (Vungle, Playhaven) across both Android and iOS. And even Admob V2 is working this way on Android. Just not on iOS. Without a callback is there any other way to detect when an admob ad has been closed?
I agree with Joe, this really needs to be more consistent across platforms, and I would argue across different ad provider plugins. I realize each provider handles things a bit differently, but surely the advantage of Corona SDK is that (ideally) it would shield me from as many of those differences as possible and provide a common interface to each ad network.
I’ve been asking for a callback for a long time, there is no way to know when the ad has been shown so you can put up banner ads again or do anything else.