Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Error When Added AdMob Plugin To Ionic Project

I have an Ionic 3 Project and its running normally on Ionic DevApp And Xcode. But When i added AdMob Plugin , its running normally Ionic DevApp but its not running on Xcode. I tried Simulator and Real Device but i have some mistake both of them.

There is my error codes;

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
like image 217
kalememre Avatar asked Apr 08 '19 16:04

kalememre


2 Answers

Have had this problem for two days now. The problem seems that the xcode project's plist file is not getting the admob settings right. So had to add them manually like this:

Open the your-app-name-Info.plist file under "ionic-project-root/platforms/ios/your-app-name/" and add these lines:

<key>GADIsAdManagerApp</key>
<true/>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-XXXXXXX~YYYYYYY</string>

Being ca-app-pub-XXXXXXX~YYYYYYY your ios app ID in admob. Now the error should go away.

like image 151
Kilian Perdomo Curbelo Avatar answered Oct 19 '22 10:10

Kilian Perdomo Curbelo


enter image description here

There is a new procedure, you need to add GADIsAdManagerApp key for info.plist file with boolean YES value

like image 27
bpolat Avatar answered Oct 19 '22 11:10

bpolat