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
Post a Comment