尝试索引上值'hudGroup'(零值)



我使用了横幅和内部活跃的AdMob然后错误。 但只使用横幅没有索引错误。这个问题在下一个场景。

local appID = "ca-app-pub-9490586669956065/9942080439"
    local appIDIN = "ca-app-pub-9490586669956065/2418813633"
    local ads = require("ads")
    local t
    local function adListener(event)
        local msg = evento.response
        print(msg)
        if event.phase == "loaded" then
        end
        if event.isError then
        end
    end
    ads.init("admob", appID, adListener)
    ads.init("admob", appIDIN, adListener)
    local function showBanner()
        ads.show("banner", {x = 2, y = display.viewableContentHeight-5, appID = "ca-app-pub-9490586669956065/9942080439",testMode = true})
    end
    local function randomDelay() 
        return math.random(12000) 
    end
    local function onTimer() 
        ads.show( "interstitial", { x=0, y=0 ,appID = "ca-app-pub-9490586669956065/2418813633", testMode = true})
    end
        local hudGroup = display.newGroup()
   timer.performWithDelay( randomDelay(), onTimer, 1)
   timer.performWithDelay(50, showBanner, 1)    

hudGroup是一个局部变量。当您更改场景时,其引用会被破坏。它要么使hudGroup成为全局变量,要么根本不使用group进行广告

最新更新