Admob test ads not showing up on iOS

Latest versions of Xcode and Solar2D running on a Macbook Apple M2 Sonoma 14.3

I successfully build to iOS device without error. Init is set up in Main.lua. The first ad is set to run with my first game.lua .Main and Menu luas work fine without issue. When I press button to go to game.lua the screen on my phone goes black and does not load any ads. The issue I am having is that it is not producing any kind of error for me to reference. Up to this point it did, like if something was wrong with my coding, plugin not being there, wrong app ID, etc… All have been resolved. The log shows that admob is in testMode.

What recommendations does anyone have for a starting point on me identifying the issue?

Update. I am now receiving the print text i added for when it fails for loading ads. However it does not provide a reason for why it failed. One message I am seeing buried in the logs is -< < Google:HTML> >48 required SKAdNetwork identifiers missing from Into.plist… but I am not using mediation so it was my understanding that all i needed in my build settings for the Skadnetwork is

SKAdNetworkIdentifier = "cstr6suwn9.skadnetwork" ,

Do I need to add anything else to build settings? And/or is there something I should add to the Info.plist?

Have you included your AdMob app id in your build.settings as specified in the documentation? Have you set up the ATT plugin?

Are you allowing AdMob to initialise before attempting to load or show ads?

I have all of those set up. Question, do I need to register my app with Firebase and download GoogleService-Info.plist, and add to the project for test ads to work?

AdMob doesn’t use firebase.

Are your test ads working as intended on Android and this is just affecting iOS?

I’m only attempting with iOS at the moment. the console log shows ads load successfully with the main.lua, but in my game.lua where I want them to show the ads, the console log then says they failed to load. do I need to initialize them in the game.lua too? The way interpreted the documentation was to initialize them with main.lua only.

Without seeing any code, I’m guessing the issue is what already asked about, i.e. allowing AdMob to initialise before attempting to load or show ads.

Initialising the plugin is not instant. It’s an asynchronous function. You need to wait until the initialisation has finished. The code execution doesn’t wait. If you start init in main.lua and immediately move to another scene via Composer and then try loading ads, it’ll fail.

Try adding a timer after init before you try to load an ad. Then add another timer after load before you try to show any ads.

Thank you for the advice. So, just a thought. Instead of trying to test the ads in my first game scene, perhaps I should try testing them in later scenes to give it more time to initialize?

The best approach is to have all of your ads related logic in a separate module that you require in main.lua and initialise when the app starts. You can also put the loading of the first ad(s) inside the init phase.

Then you require the module in other scenes where you need the ads. Then just check if an ad is loaded, if not, then load one. If an ad is loaded, show it, etc.

Ads shouldn’t be shown too soon after an app has started anyway (outside of testing), because it only drives players away.

I appreciate all the help. Thank you. This is my first time building a game, and surprisingly, the building of the game has been the easiest part for me. Trying to get these test ads to show has been the hardest part. I’m not trying to make any ad money and only planned to have them once in the entire game just so I could learn how to do it for future projects (and because I know how annoying frequent ads can be… lol). At this point I think I am just going to focus on getting the game uploaded to the AppStore and worry about figuring out ads another day. Thanks again.

for sake of argument this is the coding I am using in my main.lua. on the console log it says “Interstitial ad loaded successfully” , but then further down in the log is says “Interstitial ad failed to load”. Any advice you can provide?

local function adListener( event )
local json = require( “json” )
print("Ad event: ")
print( json.prettify( event ) )

if ( event.phase == "init" ) then  -- Successful initialization
    print( event.provider )
    print("We succeeded! interstitial ad loaded")
    admob.load( "interstitial", { adUnitId = "XXXX - my UNitID", hasUserConsent = true } )
 elseif ( event.phase == "loaded" ) then
    print( "Interstitial ad loaded successfully" )  
  elseif ( event.phase == "failed" ) then
    print( "Interstitial ad failed to load" )  
    print( event.response )  

  elseif ( event.phase == "displayed" ) then -- Ads were loaded
    if event.type == "interstitial" then
        admob.load( "interstitial", { adUnitId = "xxxx-myUnitd", hasUserConsent = true } )


if “ios” == system.getInfo(“platform”) then

myInterstitialAdUnitId = "xxxx- my UnitID"

admob.init( adListener, { testMode = true } )

One thing, you’ll need to implement AdMob’s UMP/CMP APIs.

As for what’s causing the event to fail, I’m not sure. Just taking a look at a very isolated piece of code doesn’t help much and I regrettably don’t have the time for a much deeper analysis. Based on your sample code, the adUnitIds are different, but I guess that’s just a coincidence? Maybe AdMob can’t load a new ad if there’s already an ad that’s loaded and ready to show? I’m not sure.

1 Like