1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

iOS Question I got error when using iAdMob to display Banner Ad

Discussion in 'iOS Questions' started by Modern_Digital, Jun 13, 2019.

  1. Modern_Digital

    Modern_Digital Member Licensed User

    Hi,

    I got error when using iAdMob to display Banner Ad, This is the code what i use:

    the code in Application_Start :

    Code:
    AdView1.Initialize("AdView1","ca-app-pub-**************~**********",FrmMain,AdView1.SIZE_BANNER)
           AdView1.SetTestDevices(
    Array("******************************"))
           AdView1.LoadAd
           AdView1.Alpha = 
    1
           AdView1.Visible = 
    True
           AdView1.BringToFront
              
           FrmMain.RootPanel.AddView(AdView1, 
    0100%y - 50dip100%x50dip)
    Note : I replaced the real numbers with stars.

    This is the error message :

    And i want to mention that i copied the GoogleMobileAdsSdkiOS-7.44.0 to the builder lib folder.

    What should I do to make it work correctly?

    Thank you.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Add this line:
    Code:
    #PlistExtra: <key>GADIsAdManagerApp</key><true/>
     
    Modern_Digital likes this.
  3. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    Firstly, it looks like you are using your application ID & not the ad unit ID in your Initialize call. The ad unit ID doesn't have the "~" - it has the "/".

    Secondly, per the AdMob documentation (https://developers.google.com/admob/ios/quick-start), you need to add the GADApplicationIdentifier to your plist file & include your AdMob Application ID, otherwise you will get an intialization error (exactly what it says in the error you got).

    As well as reading tutorials, etc... in the B4X forums, it helps a lot if you take the time to read the documentation related to whatever you're trying to implement - in this case the Getting Started guide for setting up AdMob in an iOS app. There are often changes implemented in new versions of the AdMob SDK & those changes won't always be reflected in the info you find on the B4X forums.

    - Colin.
     
    Modern_Digital likes this.
  4. Modern_Digital

    Modern_Digital Member Licensed User

    Thank you very much guys,

    I Added this line:

    Code:
    #PlistExtra: <key>GADIsAdManagerApp</key><true/>
    and its works now correctly, I appreciate your help.
     
  5. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    OK - didn't realize that B4i used Google Ad Manager & not the AdMob SDK...

    - Colin.
     
    Modern_Digital likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice