Crash when adding AdMob to Firebase project - ios

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.

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

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>

Related

Does Google AdMob Require Info.plist exactly?

I am trying to set up Google AdMobs on a project that I have already set Firebase up in. I have been trying to follow the Update your info.plist section of the AdMob documentation here: https://developers.google.com/admob/ios/quick-start#swift
but I keep getting the "reason: 'The Google Mobile Ads SDK was initialized without an application ID. Google AdMob publishers, follow instructions at https://googlemobileadssdk.page.link/admob-ios-update-plist to set a valid application ID. Google Ad Manager publishers, follow instructions at https://googlemobileadssdk.page.link/ad-manager-ios-update-plist." Error.
I am wondering if it is because my plist is named GoogleService-Info.plist rather than Info.plist (This is the name given by default when I first began using Firebase). If I try to rename the file to just Info.plist, the firestore part of my project breaks. Does AdMob require Info.plist to be named exactly that?
I found that it does matter what plist I add Google AdMob to. XCode 13 got rid of the Info.plist but you can manually create an info.plist by following this guide: https://betterprogramming.pub/info-plist-is-missing-in-xcode-13-heres-how-to-get-it-back-1a7abf3e2514
Pasting to info.plist solved the issue for me.
I would recommend you to dig more about Info.plist. See this official docs and this medium blog.
First, Info.plist and GoogleService-Info.plist are used for different purposes. If you rename those files some of the service will break surely.
Second, Even if XCode 13, there is Info.plist(though you can't see in project navigator for fresh project). See this medium blog how to configure Info.plist for XCode 13

Problem in updating Google-Mobile-Ads-SDK for iOS

I want to update the Google-Mobile-Ads-SDK pod for removing the instances of UIWebView, but according to the documentation link, there needs to be a GADApplicationIdentifier that has to be added to the Info.plist file in order to initialise the SDK properly. I don't have an admob account, I only use Ad-Manager for showing native ads in the app. Is there any other way to update the SDK without adding the GADApplicationIdentifier in Info.plist
Got the solution for this:
If you don't have an AdMob account and you are showing the ads using AdManager, then you can add the following key GADIsAdManagerApp to YES in your Info.plist, to initialise the Ads SDK properly with the latest version

Crashes not showing in Firebase console after linking from Fabric to Firebase

I am trying to link my app to firebase so I followed all the steps in this link correctly https://docs.fabric.io/apple/examples/cannonball/index.html and when I force a crash It doesn't show in Firebase console but when I add back Fabric.with([Crashlytics.self])
it works fine and the crash appears in both fabric and firebase.
I tried also removing api key from info.plist and change run script to "${PODS_ROOT}/Fabric/run" still crashes don't appear in firebase nor fabric
At the moment of writing, iOS applications migrating from Fabric to the Firebase should follow Fabric integration documentation (not the Firebase Crashlytics documentation).
Do not remove Fabric keys from Info.plist
Do not remove [Fabric with:] call
Do run "${PODS_ROOT}/Fabric/run" script with arguments (providing old Fabric API Key)

App Delegate crashes because of Firebase initialization

I am getting this error that's causing the AppDelegate to crash
Terminating app due to uncaught exception 'com.google.greenhouse', reason: 'Error Domain=com.google.greenhouse Code=-102 "Unable to correctly configure subspec Analytics" UserInfo={NSLocalizedFailureReason=Tracking ID must not be nil or empty., NSLocalizedDescription=Unable to correctly configure subspec Analytics}'
I have followed the Firebase guide from here
What can be the reason?
Also I don't intend to use google analytics as for now. Any fix?
EDIT:
Note: I have removed the IDs and the Keys for this screenshot
The accepted solution was to remove Google Analytics.
But you actually can have both Firebase and Google Analytics.
The solution I found was to add TRACKING_ID into GoogleService-Info.plist
for example, add this:
<dict>
<key>TRACKING_ID</key>
<string>UA-XXXXXX-X</string>
I asked the Firebase team on this issue and they have responded.
Things you can check if the issue still persist.
Check to see that the GoogleService-Info.plist file is at the correct location i.e at the project root.
Check your IS_ANALYTICS_ENABLED in the google plist. Try changing it.
Try removing pod 'Google/Analytics'.
Add -FIRAnalyticsDebugEnabled to get more debugging information.
My problem was solved by removing Google/Analytics pod.
We had the exact same error and solved by removing
pod 'Google/Analytics'
from Podfile.
In our case, we had been using GA and switch to Firebase + TagManager Solution, but just forgot to remove 'Google/Analytics' from Podfile.
(Even we remove 'Google/Analytics', TagManager installs GoogleAnalytics for dependencies but errors are gone. Curious but it works...)
If would like to have both Google Analytics and Firebase. Please add two lines of code in GoogleService-Info file. Hope it will help
<key>TRACKING_ID</key>
<string>UA-123456789-0</string>
Enable/Disable Services That You Want in my Case i only need Analytics so i set YES in IS_ANALYTICS_ENABLED and Other services set to NO.
Source
Delete From Podfile --> pod 'Google/Analytics'
If it was not the location of your googleservice-info.plist file. Check your IS_ANALYTICS_ENABLED in the google plist. Maybe try changing it to the opposite of what it currently is.
Also, you can add this launch option to get more debug info. Maybe it will help.
Product -> Scheme -> Edit Scheme -> Arguments passed on launch:
-FIRAnalyticsDebugEnabled
None of the solutions suggested here worked for me. The only thing that did was disabling Firebase Analytics, by adding "FIREBASE_ANALYTICS_COLLECTION_ENABLED" (Boolean) to GoogleService-Info.plist and setting it to "NO" (taken from: https://firebase.google.com/support/guides/disable-analytics)
Make sure the GoogleService-Info.plist file is at the correct location i.e at the project root.
I have added a screenshot of my project for you to check for reference.

iOS - Google AdMob v6.12.0 - "idfa class missing, won't collect idfa"

I'm using Google AdMob (DFP & Mediated Interstitials) for a project in iOS 8 (target iOS 7).
And even though I've included what I think are all the necessary Frameworks for AdMob v6.12.0 (according to the AdMob site), I'm seeing the following warning message in Xcode:
"idfa class missing, won't collect idfa"
According to AdMob's release notes, v6.12.0 SDK uses Apple's idfa...
"The SDK uses IDFA under the guidelines laid out in the iOS developer
program license agreement."
( http://tinyurl.com/n4f3fn7 )
So... I'm stumped by this warning message in the Xcode console.
MY QUESTION:
Should I disregard this message? What could I be missing here?
FYI -- Here is a list of the Frameworks I'm including in my Project:
Thanks!
All you have to do is to add libAdIdAccess.a to your project. It is part of GoogleAnalyticsServicesiOS_3.09 delivery.
You need to add AdSupport.framework
That line only says that it cannot access to idfa

Resources