jvic
jvic

Reputation: 245

Crash when adding AdMob to Firebase project

I've got an iOS project using Firebase, it's working fine. However, when I try to add AdMob, the app crashes when launching:

"'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'"

Just by adding pod 'Firebase/AdMob' to the Podfile already produces this crash.

Then I added GADApplicationIdentifier to the GoogleService-Info.plist:

<key>GADApplicationIdentifier</key>
<string>APP_KEY</string>

Same thing, crash.

The app is linked to Firebase in the AdMob app site.

Anybody has any tips on this? Google's docs don't seem to be up to date, making a lot of confusion about AdMob implementation with/without Firebase.

Upvotes: 3

Views: 2030

Answers (3)

Md Imran Choudhury
Md Imran Choudhury

Reputation: 10057

In Xcode 15: First have to update Info.plist following this: https://googlemobileadssdk.page.link/admob-ios-update-plist

After that manually add the -ObjC linker flag to Other Linker Flags in your target's build settings

enter image description here

Upvotes: 0

Paras Dharasanda
Paras Dharasanda

Reputation: 213

Info.plist add following line not GoogleService-Info.plist.

 <key>GADIsAdManagerApp</key>
 <true/>

also add key of Google Ads Mob

 <key>GADApplicationIdentifier</key>
 <string>key-value</string>

Upvotes: 3

Paul Beusterien
Paul Beusterien

Reputation: 29582

Update the app's Info.plist - the file set in the INFOPLIST_FILE Build Setting - not GoogleService-Info.plist.

Upvotes: 5

Related Questions