Zigglzworth
Zigglzworth

Reputation: 6823

iOS Swift - Firebase custom event logging not working

I have set my app to log analytic events to Firebase

I have carefully followed the official Firebase tutorial

I have also watched the video here

I have added the FIRAnalyticsDebugEnabled to my scheme as you can see in the image

enter image description here

I have ensured that events have no white spaces (underscores instead) and that they meet the character limit

My Firebase core and Analytics are set correctly because I can see the standard set of Firebase events that are automatically logged and general statistics etc but NONE OF MY CUSTOM EVENTS ARE LOGGED

here is an example line of code I use to log a simple event (string):

    Analytics.logEvent(eventName, nil) //eventName is a string

This is what I see in the xcode debug console upon custom event logging:

    myapp[2977:1016413] [Firebase/Analytics][I-ACS000000] Logging event: origin, name, params: auto, error (_err), {

This debug information tells me nothing and i'm not sure FIRAnalyticsDebugEnabled is even working correctly

Any ideas on what I could be doing wrong ?

Upvotes: 7

Views: 7161

Answers (4)

Rahul Serodia
Rahul Serodia

Reputation: 469

I also ran into same issue and I tried adding -FIRAnalyticsDebugEnabled and -FIRDebugEnabled in scheme, also tried setting IS_ANALYTICS_ENABLED to true in GoogleService-Info.plist but no trace of firebase event logs in XCode console. What worked for me was unchecking OS_ACTIVITY_MODE in edit scheme and my console was flooded with log events of firebase. Hope this helps someone. Scheme Edit Snap

Upvotes: 8

Andriy Petrovskiy
Andriy Petrovskiy

Reputation: 11

Maybe it's to late, but if your events does't works also you doesn't get messages in debug screen:

There are in GoogleService-Info.plist, try to change value of IS_ANALYTICS_ENABLED to YES

Upvotes: 1

snowykz
snowykz

Reputation: 256

I think the problem is with your event parameters.

Please change your code to this:

Analytics.logEvent(eventName, parameters: nil)

If that doesn't work then send an empty array:

Analytics.logEvent(eventName, parameters: [])

or for Swift 4.2:

Analytics.logEvent(eventName, parameters: [:])

Upvotes: 2

kennedy
kennedy

Reputation: 11

Just download the file GoogleService-Info.plist from Firebase again, and make sure do not change anything then replace that file in you XCode then everything should be okay.

Upvotes: 0

Related Questions