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 = com.google.admob 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
B4X:
'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)
    
    analitycs.Initialize
    
    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
    PagesManager.Initialize(NavControl)
End Sub

'Template version: B4i-1.0
#Region Delegates
Private Sub Application_Background
    B4XPages.Delegate.Activity_Pause
End Sub

Private Sub Application_Foreground
    B4XPages.Delegate.Activity_Resume
End Sub
#End Region


# B4XMainPage
B4X:
#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&Args=Project.zip

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
    
    Root.LoadLayout("MainPage")

    iad.Initialize("iad","ca-app-pub-cccc")
    
    #if B4A
        iad.LoadAd
    #else
        iad.RequestAd
    #End If
    
    ImageView1.Bitmap = LoadBitmapResize(File.DirAssets, "logo.png", 80%x, 80%x, True)
    
    Sleep(3000)
    WebView1.LoadUrl("https://www.b4x.com")

End Sub

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

#if B4A
Sub WebView1_PageFinished (Url As String)
#Else
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
    iad.Show
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
    Else
        Log(LastException)
    End If
End Sub

#End If
 
Top