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

Modern_Digital

Member
Licensed User
Longtime User
Hi,

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

the code in Application_Start :

B4X:
       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, 0, 100%y - 50dip, 100%x, 50dip)

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.
 

Computersmith64

Well-Known Member
Licensed User
Longtime 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.
 
Upvote 0

Modern_Digital

Member
Licensed User
Longtime User
Thank you very much guys,

I Added this line:

B4X:
#PlistExtra: <key>GADIsAdManagerApp</key><true/>

and its works now correctly, I appreciate your help.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…