Search code examples
iosswiftframeworksfirebase-analyticsswift-framework

Implementing Firebase Analytics in a swift framework


i'm trying to configure Firebase Analytics with cocoapods in our app.

The app has an architecture like this:

App <- App-Framework 

The app is basically just the AppDelegate importing App-Framework - which is the whole app.

Then to the problem, i'm doing this in AppDelegate:

FirebaseApp.configure()

After this i try to log an event to Analytics in the App-Framework with:

Analytics.logEvent("testEvent", parameters: [
      "name": "Krister" as NSObject,
        "full_text": "Krister tester" as NSObject
])

And the debugger then says:

Event not logged. Call +[FIRApp configure]: share_image

The framework and the app imports Firebase trough cocoapods and the general Firebase Analytics setup is not missing anything, like the GoogleServices.plist and imports.

I tried to implement this in an app with no framework and the events get logged to the Firebase Console and DebugView.

The weirdest thing is that the default screen tracking is getting logged, but none of the logEvents().

What to do next?


Solution 1:

I ran the FirebaseApp.configure() inside App-Framework, trough a method inside of AppDelegate.


Solution

  • Ran the FirebaseApp.configure() inside App-Framework, through a method inside of AppDelegate.