iOS Question [ iAdMob ] Code= 1 "Request Error: No ad to show."

Waldemar Lima

Well-Known Member
Licensed User
Hello guys, I'm in an unusual situation ...
Yesterday I created a new ad block on admob, and I created a new app ... and I waited about 12 hours to test again if the interads appears, but so far nothing!

but when I change the 'myoldcert.mobileprovision' certificate to an old one the ad appears ... and in the new 'mynewcert.mobileprovision' certificate the error occurs: '<B4IExceptionWrapper: Error Domain = Code = 1 "Request Error: No ad to show. " UserInfo = {NSLocalizedDescription = Request Error: No ad to show., Gad_response_info = <GADResponseInfo: 0x283f95d70>}> '

I have tried almost everything ... does anyone have any idea if there is something wrong with the certificate itself, with the project or google admob has to approve the certificate?

# Main
'Code module
#Region  Project Attributes
    #ApplicationLabel: MyApp test
    #Version: 1.0.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #Target: iPhone, iPad
    #ATSEnabled: true       
    #MinVersion: 8
#End Region

#PlistExtra: <key>GADIsAdManagerApp</key><true/>
#AdditionalLib: libsqlite3.dylib
#AdditionalLib: libz.dylib
#AdditionalLib: WebKit.framework

#PlistExtra: <key>UIViewControllerBasedStatusBarAppearance</key><false/>
#CertificateFile: ios_distribution.cer
#ProvisionFile: mynewcert.mobileprovision

Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
    Dim analitycs As FirebaseAnalytics
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    NavControl.NavigationBarVisible = False
    NavControl.ToolBarVisible = False

    Dim no As NativeObject = App
    no.RunMethod("setStatusBarStyle:", Array(1))
    Dim no As NativeObject = NavControl
    no.GetField("navigationBar").RunMethod("setBarStyle:", Array(2))
    Dim no As NativeObject = App
    no.RunMethod("setStatusBarHidden:animated:", Array(True, False))
    Dim PagesManager As B4XPagesManager
End Sub

'Template version: B4i-1.0
#Region Delegates
Private Sub Application_Background
End Sub

Private Sub Application_Foreground
End Sub
#End Region

# B4XMainPage
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region

'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&

Sub Class_Globals

    Private Root As B4XView
    Private xui As XUI
    Private WebView1 As WebView
    Private bgp As Panel
    Private ImageView1 As ImageView
    Dim iad As InterstitialAd

End Sub

Public Sub Initialize
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1

    #if B4A
    #End If
    ImageView1.Bitmap = LoadBitmapResize(File.DirAssets, "logo.png", 80%x, 80%x, True)

End Sub

Sub WebView1_JSComplete (Success As Boolean, Tag As Object, Result As String)
End Sub

#if B4A
Sub WebView1_PageFinished (Url As String)
Sub WebView1_PageFinished (Success As Boolean, Url As String)
#End If
    bgp.Visible = False
End Sub

Sub GetErrorCodeAd(ErrorCode As String) As String
    Dim str_error As String
    Select ErrorCode
        Case 0
            str_error = "INTERNAL_ERROR"  'Something happened internally; for instance, an invalid response was received from the ad server.
        Case 1
            str_error = "INVALID_REQUEST" 'The ad request was invalid; for instance, the ad unit ID was incorrect.
        Case 2
            str_error = "NETWORK_ERROR"   'The ad request was unsuccessful due to network connectivity.
        Case 3
            str_error = "NO_FILL"         'The ad request was successful, but no ad was returned due to lack of ad inventory
    End Select
    Return ErrorCode & " - " & str_error
End Sub

#if B4A

Sub iad_AdFailedToLoad (ErrorMessage As String)
    Log("iad AdFailedToLoad: " & GetErrorCodeAd(ErrorMessage))
End Sub

Sub iad_AdClosed
    Log("iad AdClosed")
    iadAberto = 1
    'iad.LoadAd 'prepare a new ad
End Sub

Sub iad_AdLoaded
    Log("mwadi2 Adloaded")
End Sub

Sub iad_ReceiveAd
    Log("mwadi2 ReceiveAd")
    'ToastMessageShow("Interstitial Received", False) 'show only in the example
End Sub

#End If

#if B4i

Sub iad_Ready (Success As Boolean)
    If Success Then
        Log("iad is ready.")
        iad.Show(B4XPages.GetNativeParent(Me)) 'show ad
    End If
End Sub

#End If