1

I'm having a crash on [FIRApp configure] step in my AppDelegate's didFinishLaunchingWithOptions method.

Crash gives me completely no information.

But I'm using Google Analytics SDK in my app as well. Maybe that's could be the reason?

So my question is - is it possible to use both Google Analytics and Firebase SDKs at the same time in one app?

Thanks.

Alexey Pelekh
  • 1,143
  • 13
  • 20

2 Answers2

1

I resolved my problem. For GA tracking we should use this lines of code in AppDelegate's didFinishLaunchingWithOptions method.

guard let gai = GAI.sharedInstance() else {
  assert(false, "Google Analytics not configured correctly")
}
gai.tracker(withTrackingId: "YOUR_TRACKING_ID")

For Firebase tracking we should use

FirebaseApp.configure()

in the same place. This method is the default method for the Firebase initialization in your application. It takes all the needed for init data from the GoogleService-Info.plist file which you should download from your dashboard on the Firebase. And it was crashing for me on the init step.

So the actual problem: Default GoogleService-Info.plist file don't include the TRACKING_ID field which is required for the Firebase initialization.

Solution: Just add the TRACKING_ID property to your GoogleService-Info.plist file. The value of this property should have this format: UA-XXXXXXXX-XX.

Alexey Pelekh
  • 1,143
  • 13
  • 20
0

It is possible to use both Google Analytics and Firebase Analytics without any issue.

Fix crash:

You need to download GoogleService-Info.plist from Firebase Console and add it to your project. When you call [FIRApp configure] it tries to read configuration related data from this plist file. If it is unable to find it, your will crash.

Instructions on how to download this configuration file

Once you download it, simply drag and drop to your project directory in Xcode. This will initialize Firebase and stop your app from crashing.

Bhaumik
  • 1,218
  • 1
  • 11
  • 20