Admob works fine on Android but when I tried to build on IOS device, banner, interstitial and video ads are not showing up
-
Do you have the right build.settings setup? Network permissions, and all that good stuff.
-
What messages are you getting in the xCode log?
That error also sounds a lot like you’re doing this:
- init()
- load()
- show()
You can’t simply call the various functions one after the other. That is not how ad code works.
You need to write a listener to:
- detect the init completion, then load an ad
- detect the ad got loaded, then show the ad
PS - Are you using the paid admob plugin? Don’t assume we know how you’re using AdMob. There are actually a few ways to use it, so give us a link(s) to the docs on this site you are using so we can give you proper help.
Are you calling admob.load()?
Yes, I am calling admob.load() after init completion.
I am getting this messages in xCode log when I am trying admob.show()
[Device] WARNING: admob.show(adType [, options]), Banner not loaded for adUnitId
Are you getting a ‘loaded’ indication in your listener?
Correction* My interstital Ad is working properly. Banner and Rewared video ads are not working
When I tried to print admob.isLoaded(“banner”) it is always false
I just tested AdMob ads on iOS this past weekend and it’s showing banner ads just fine. Now this isn’t a scene based app (that is I always show banner ads for the duration of the app regardless of the scene, so I can do my loading and showing in the event listener.)
-- -- Initialize ads -- -- Android AdMob IDs mydata.appId = "ca-app-pub-5387XXXXXXXXXXXX~XXXXXXXX70" mydata.bannerUnitId = "ca-app-pub-5387XXXXXXXXXXXX/XXXXXXXX75" if device.isApple then -- Apple AdMob IDs mydata.appId = "ca-app-pub-5387XXXXXXXXXXXX~XXXXXXXX70" mydata.bannerUnitId = "ca-app-pub-5387XXXXXXXXXXXX/XXXXXXXX79" end local function adListener( event ) -- event table includes: -- event.provider -- event.isError (e.g. true/false ) utility.print\_r(event) local msg = event.response -- just a quick debug message to check what response we got from the library print("Message received from the ads library: ", msg) if event.phase == "init" then admob.load( "banner", { adUnitId = mydata.bannerUnitId, hasUserConsent = mydata.settings.hasUserConsent or false } ) elseif event.phase == "loaded" then admob.show( "banner", { y = "top" } ) end end if not mydata.settings.isPaid then print("initiing admob") admob.init( adListener, { appId = mydata.appId, testMode = true } ) end
The table mydata.settings holds my app settings where I track if the user has granted consent or not.
Rob
-
Do you have the right build.settings setup? Network permissions, and all that good stuff.
-
What messages are you getting in the xCode log?
That error also sounds a lot like you’re doing this:
- init()
- load()
- show()
You can’t simply call the various functions one after the other. That is not how ad code works.
You need to write a listener to:
- detect the init completion, then load an ad
- detect the ad got loaded, then show the ad
PS - Are you using the paid admob plugin? Don’t assume we know how you’re using AdMob. There are actually a few ways to use it, so give us a link(s) to the docs on this site you are using so we can give you proper help.
Are you calling admob.load()?
Yes, I am calling admob.load() after init completion.
I am getting this messages in xCode log when I am trying admob.show()
[Device] WARNING: admob.show(adType [, options]), Banner not loaded for adUnitId
Are you getting a ‘loaded’ indication in your listener?
Correction* My interstital Ad is working properly. Banner and Rewared video ads are not working
When I tried to print admob.isLoaded(“banner”) it is always false
I just tested AdMob ads on iOS this past weekend and it’s showing banner ads just fine. Now this isn’t a scene based app (that is I always show banner ads for the duration of the app regardless of the scene, so I can do my loading and showing in the event listener.)
-- -- Initialize ads -- -- Android AdMob IDs mydata.appId = "ca-app-pub-5387XXXXXXXXXXXX~XXXXXXXX70" mydata.bannerUnitId = "ca-app-pub-5387XXXXXXXXXXXX/XXXXXXXX75" if device.isApple then -- Apple AdMob IDs mydata.appId = "ca-app-pub-5387XXXXXXXXXXXX~XXXXXXXX70" mydata.bannerUnitId = "ca-app-pub-5387XXXXXXXXXXXX/XXXXXXXX79" end local function adListener( event ) -- event table includes: -- event.provider -- event.isError (e.g. true/false ) utility.print\_r(event) local msg = event.response -- just a quick debug message to check what response we got from the library print("Message received from the ads library: ", msg) if event.phase == "init" then admob.load( "banner", { adUnitId = mydata.bannerUnitId, hasUserConsent = mydata.settings.hasUserConsent or false } ) elseif event.phase == "loaded" then admob.show( "banner", { y = "top" } ) end end if not mydata.settings.isPaid then print("initiing admob") admob.init( adListener, { appId = mydata.appId, testMode = true } ) end
The table mydata.settings holds my app settings where I track if the user has granted consent or not.
Rob