Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Not able to push custom events in Firebase Analytics

$
0
0

My environment:
Windows
Visual Studio 2017 version 15.8.9
Nuget Packages:
Xamarin.Firebase.iOS.Analytics - 5.1.4
Xamarin.Firebase.iOS.Core - 5.1.3
Xamarin.Firebase.iOS.InstanceID - 3.2.1

I have mentioned following mlaunch and start argument in iOS project properties -> iOS Run Optionts:
--argument=-FIRAnalyticsDebugEnabled

I am getting auto events like session_start, screen_view so my iOS App is sending events to Firebase.

I have implemented following solution for Firebase Analytics:
https://stackoverflow.com/questions/48774378/firebase-analytics-in-xamarin-forms/50764452#50764452
However I am facing issues in pushing custom events to Firebase for my iOS project. Android is pushing these custom events properly.

First problem:
following code throws an ambiguous error.(https://forums.xamarin.com/discussion/136547/firebase-analytics-the-call-is-ambiguous-between-the-following-methods-or-properties)
if (parameters == null) { Analytics.LogEvent(eventId, null); return; }

So I tried following options:
option 1:
if (parameters == null) { Firebase.Analytics.Analytics.LogEvent(eventId, new Dictionary<object, object>(){{"key1", "value1"}}); return; }

Option 2:
`var keys = new List();
var values = new List();

        if (parameters == null)
        {
            //Firebase.Analytics.Analytics.LogEvent(eventId, NSDictionary<NSString, NSObject>.FromObjectsAndKeys(values.ToArray(), keys.ToArray(), keys.Count));
            //return;
            keys.Add(new NSString("Parameter"));
            values.Add(new NSString("NONE"));
        }
        else
        {
            foreach (var item in parameters)
            {
                keys.Add(new NSString(item.Key));
                values.Add(new NSString(item.Value));
            }
        }
      var parametersDictionary =
      NSDictionary<NSString, NSObject>.FromObjectsAndKeys(values.ToArray(), keys.ToArray(), keys.Count);
      Firebase.Analytics.Analytics.LogEvent(eventId, parametersDictionary);`

Both these options are not working. When I am checking debug log, I can find following

  • [I-ACS025018] Event not logged. Call +[FIRApp configure]: iOSAnalyticsStarted

I have attached whole log file. Can anyone please help?

THanks.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>