I am trying to put ads in my game and it seems something went wrong. I have attached a screen shot of it.
It says attempt to call a nil value and more.I have studied updated star explorer project and added the code as it says in the main.lua file. I am not wanting to build game for ios and don’t want to put ads for it.The code in build file and then main.lua is as followed.
settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", }, }, plugins = { ["plugin.coronaAds"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["shared.android.support.v4"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, } excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, -- -- iOS Section -- iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-167.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, }, }, -- -- Android Section -- android = { usesPermissions = { "android.permission.INTERNET", }, }, }
composer.gotoScene( "menu" ) local coronaAds = require( "plugin.coronaAds" ) local apiKey = "myapikeyno" -- Corona Ads listener function local function adListener( event ) -- Successful initialization of Corona Ads if ( event.phase == "init" ) then composer.setVariable( "coronaAdsInitialized", true ) end end coronaAds.init( apiKey, adListener )