'GADInvalidInitializationException', reason: 'The Google Mobile Ads SDK was initialized without AppMeasurement - ios

I was trying to test Admob ads. However, it's getting an exception before the app starts
'GADInvalidInitializationException', reason: 'The Google Mobile Ads SDK was initialized without AppMeasurement.
However, I have added the AppID and cocoapod
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
podfile
target 'My App' do
use_frameworks!
pod 'Google-Mobile-Ads-SDK'
end
Info.list
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize Google Mobile Ads SDK
GADMobileAds.sharedInstance().start(completionHandler: nil)
return true
}
Have anyone faced this issue? Thanks in Advance.

In case anyone else is facing the problem, I am answering my own question.
According to the documentation, this step is in manual download. However, that is a mandatory step to do even if you are using cocoapod.

Related

Firebase Error While Adding To Project Using Cocoapods

Firstly, I would like to let you know that I have user Firebase Firestore several times before and have not faced such an error... I have followed the process correctly step by step and, because it was not working, I also tried to add firebase to an existing project and it has still given me errors. Below is there error which I get :
2020-05-21 09:32:15.775788+0530 Job App[61230:1180572] [GoogleDataTransport][I-GDTCOR001006] (/Users/tejas/Desktop/Files/Coding/Main Projects/Job App/Pods/GoogleDataTransport/GoogleDataTransport/GDTCORLibrary/GDTCOREvent.m:59) : There was an error saving the new counter value to disk.
Keep in mind that this error only pops up the first time I run the app on the simulator, then when I rerun it this error is gone. My app also doesn't even crash and the build always succeeds despite this error. Here is my app information:
Here is the code in my app delegate
import Firebase
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
// Override point for customization after application launch.
FirebaseApp.configure()
return true
}
My GoogleService-Info.plist file has the correct bundle ID :
Here is the file inspector of my GoogleService-Info.plist:
Here is the code inside my podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
target 'Job App' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Job App
pod 'lottie-ios'
pod 'Firebase/Firestore'
end
Here is the message I get from the Firebase App Setup Wizard :
These are the pods under the pods folder :
It keeps on loading for a very long time and I'm sure that something is going wrong...
Do pod update and make sure that the GoogleDataTransport pod is at version 6.1.1.
This issue was fixed a few weeks ago. See https://github.com/firebase/firebase-ios-sdk/issues/5421

iOS Firestore App runs on Simulator but not on phone

I am developing an App that uses Firestore. The app runs fine on the Xcode simulator, but crashes when I try to run it on my phone. I get the following error message:
*** Terminating app due to uncaught exception 'FIRIllegalStateException', reason: 'Failed to get FirebaseApp
instance. Please call FirebaseApp.configure() before using Firestore'
I do call FirebaseApp.configure() in the didFinishLaunchingWithOptions:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
return true
}
I don't understand why it would run in the simulator and not on my phone. Any help would be appreciated.
Check your podfile for how you add the firebase cocoapods, It should be like this,
pod 'FirebaseCore'
pod 'Firebase/Messaging'
If your podfile different ,please remove old firebase related pods,insert this and install.
I discovered, on a Japanese code forum, what to do. I added the following code to the AppDelegate.swift file:
var window: UIWindow?
override init() { //初期化メソッドを追記
FirebaseApp.configure()
}
The app now runs both in the simulator and on my iPhone.

Wrong Symbol Files uploaded by firebase crash reporting

When a crash gets uploaded to the firebase dashboard it always shows the message Upload symbol file to symbolicate future stack traces for UUID *******. However I did make sure that the symbol files got uploaded by looking in the Symbol Files tab. Something I noticed though was that the symbol files had a different UUID then what the message on the crash said. What might I be doing wrong here?
Something strange is that it seems like neither the UUID in uploaded symbol files nor in the message mentioned above is correct. I get a third UUID when I check it up locally by following this guide (basically running find . -iname *.app in ~/Library/Developer/CoreSimulator/Devices/).
I first got this issue in our app using swift 2 and xcode 7. However I also gets the same issue using a new firebase app (ios sdk v3.8) and a minimal xcode 8 project with swift 3 that is setup exactly as advised in the docs.
// AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FIRApp.configure()
return true
}
// ViewController.swift
override func viewDidLoad() {
super.viewDidLoad()
FIRCrashMessage("A test message")
fatalError()
}
// Run script in Build Phases that uploads symbol files
GOOGLE_APP_ID=our_google_app_id
"${PODS_ROOT}"/FirebaseCrash/upload-sym "serviceaccount.json"
// Podfile (using latest versions as of 2017-05-12, v3.17.0)
pod 'Firebase/Core'
pod 'Firebase/Crash'
I think maybe the path of "ServiceAccount.json" is wrong, please check again. It should be
"${PODS_ROOT}"/FirebaseCrash/upload-sym "/Path/To/ServiceAccount.json"
And you need also to add this in the script.
rm $HOME/Library/Preferences/com.google.SymbolUpload*

NSException when using Firebase

I followed all the steps correctly to install Firebase to my iOS App and it still doesn't work. In the application method, I added FIRApp.configure() like so:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
FIRApp.configure()
return true
}
And I keep receiving NSException errors. Firebase seems to work on my Android Project, what's the deal with iOS?
I believe this is some sort of Swift 3 issue, because I encountered a similar problem. After looking over the internet, I believe that Firebase 3 hasn't updated to recent Swift Syntax located in Swift 3. Many other developers are having trouble with it as well. As an alternative, you could switch back from Xcode 8 and into 7, which would allow you to create your application which will work with current IOS, and when Firebase updates, it will be easy for you to migrate to Swift 3.
Hope this helps,
Morgan Gallant

Swift 2.0 and Google Analytics: Use of unresolved identifier "GAI"

I tried with CocoaPods and wound up with this issue after trying for hours and figured it was CocoaPods. Uninstalled CocoaPods and installed the SDK manually and wound up with the same issue.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
GAI.sharedInstance().trackerWithTrackingId("UA-XXXX-Y");
return true
}
This results in the error Use of unresolved identifier "GAI". I have a bridging header that imports the appropriate header files and all the required libraries included in my Build Phases. Please help!
Apparently I just needed to clear my derived data and restart Xcode. Xcode sucks sometimes. Ha. Thank you Björn Ro.

Resources