iAds Listener don't work

Hi there - I just tested the iAds Workaround - in Simulator I got a test interstitial - but I got now Event Listener - where is the mistake? It works fine with Admob :frowning:

Thank you

Anthony


[lua]

myText3 = display.newText(“Tell me…”, 0, 0, font, 18)

myText3.x, myText3.y = 512,300

adNetwork = “iads”

appID = “com.3id-studios.funfair”

ads = require “ads”

ads:setCurrentProvider(“iads”)

function iadListener( event )

– event table includes:

– event.provider

– event.isError (e.g. true/false )

– event.response - the localized description of the event (error or confirmation message)

   local msg = event.response

   print( "Message from the ads library: ", msg )

   myText3.text = "Message from the ads library: ", msg

   if ( event.isError ) then

       – attempt to fetch another ad

   )

   elseif ( event.phase == “loaded” ) then

       – an ad was preloaded

       ads.show( “interstitial”)

   elseif ( event.phase == “shown” ) then

       – the ad was viewed and closed

   end

end

ads.init( adNetwork, appID, iadListener )

ads.load( “interstitial” )

[/lua]

Unless I’m reading this wrong, you said in the “simulator”?

iAds do not work in the simulator.  In fact most ads do not.  You need to test ads on a device.  RebMob is one of the exceptions I know of.

Also, if you feel the listener is not getting called, try this instead:

local function iadListener( event ) -- you should really make this a local function, but... for k,v in pairs(event) do print("iadListener ", k, v, system.getTimer()) -- print everything that happens end end

It was the xcode simulator - not the corona one :slight_smile:

I’ll try your code!

Unless I’m reading this wrong, you said in the “simulator”?

iAds do not work in the simulator.  In fact most ads do not.  You need to test ads on a device.  RebMob is one of the exceptions I know of.

Also, if you feel the listener is not getting called, try this instead:

local function iadListener( event ) -- you should really make this a local function, but... for k,v in pairs(event) do print("iadListener ", k, v, system.getTimer()) -- print everything that happens end end

It was the xcode simulator - not the corona one :slight_smile:

I’ll try your code!