Skip to main content

Xcode Error When Added AdMob Plugin To Ionic Project

Xcode Error When Added AdMob Plugin To Ionic Project

I have an Ionic 3 project .When I Add Admob free plugin in my project  for running Ads in my mobile Application But I got an error when I want to run it inside the Xcode .It displays an error like:

Terminating app due to uncaught exception
'GADInvalidInitializationException', reason: 
'The Google Mobile Ads SDK was initialized incorrectly. 
Google AdMob publishers should follow instructions here: 

https://googlemobileadssdk.page.link/admob-ios-update-plist 
to include the AppMeasurement framework, 
set the -ObjC linker flag, and set 
GADApplicationIdentifier with a valid App ID. 

Google Ad Manager publishers should follow 
instructions here: 
https://googlemobileadssdk.page.link/ad-manager-ios-update-plist
The problem seems that the xcode  project's plist file is not geeting the admob settings right. So had to add them manually like this

<key>GADIsAdManagerApp</key>
<true/>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-XXXXXXX~YYYYYYY</string>
You can add key in plist by using another method  like this:

Add these lines of code  in your config.xml file of your ionic project

<platform name="ios">
   <config-file parent="GADApplicationIdentifier" target="*-Info.plist">
      <string>ca-app-pub-xxxxx-xxxxxx</string>
   </config-file>

   <config-file parent="GADIsAdManagerApp" target="*-Info.plist">
      <true />
   </config-file>

   ... (other lines) ...

</platform>
Being ca-app-pub-XXXXXXX-XXXXXXXX your  admob ios App ID. Now the error should go away.


Comments

Popular posts from this blog

How to align Title at center of ActionBar in Android

How to Align Title At Center of Action Bar in Android                                                                                                                                                @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTitle("DashBoard"); }   Activity  public void setTitle ( String title ){ getSupportActionBar (). setHomeButtonEnabled ( true ); getSupportActionBar (). setDisplayHomeAsUpEnabled ( true ); TextView textView = new TextView ( this ); textView . set...

SQLite Database With Android

Android provides several ways to store user and app data. SQLite is one way of storing user data. SQLite is a very light weight database which comes with Android OS. In this tutorial I’ll be discussing how to write classes to handle all SQLite operations. SQLite is a opensource  SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relation database features. In order to access this database you don't need to establish any kind of connections for it like JDBCODBC etc. In this tutorial I am taking an example of storing user Detail in SQLite database. I am using a table called UserMaster to store user detail. This table contains three columns  id (INT) , userid (VARCHAR) , username (VARCHAR) , password (VARCHAR) , address (VARCHAR) . Database- Package The main package is android.database.sqlite that contains the classes to mange your own database. In this Class we are creat...

Difference Between Pending Intent And Intent in Android

                       Normal Intent       Normal Intent will die as soon as the app being killed.    An Android Intent is an object carrying an intent, i.e a message from one Component to another     Component either inside or outside of the application.Intent can communicate message among     any of the three core Components of an application -- Activities, Services,and BroadcastReceivers.     Two types of Intent in Android   1. Explicit Intent.   2.Implicit Intent  Explicit Intent is an Intent which is used to Call the another component Explicitly in your application  Like :We are calling  Next activity on button click of First activity using Intent Example  // Explicit Intent by specifying its class name Intent i = new Intent ( this , TargetActivity . class ); i . putExtra ( "Key1" , "ABC" ); ...