1

After working through Firebase's Analytics tutorial to add Analytics I'm able to see the sample code working after adding it to my app. To test it out, I added the analytics event to an IBAction method for when a specific button is tapped. The problem is that when I look at the console with Debug options turned for analytics, it shows the event firing multiple times. Why could this be happening?

Here is the debug console log:

2017-02-22 13:47:12.010901 NotKarltonBanks[1537:425489] <FIRAnalytics/DEBUG> Logging event: origin, name, params: app, select_content, {
    "_o" = app;
    "_sc" = MoreViewController;
    "_si" = "-3358907490504482271";
    "content_type" = button;
    "item_id" = "id-1";
    "item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
}
2017-02-22 13:47:12.012 NotKarltonBanks[1537:] <FIRAnalytics/DEBUG> Logging event: origin, name, params: app, select_content, {
        "_o" = app;
        "_sc" = MoreViewController;
        "_si" = "-3358907490504482271";
        "content_type" = button;
        "item_id" = "id-1";
        "item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
    }
2017-02-22 13:47:12.019693 NotKarltonBanks[1537:425489] <FIRAnalytics/DEBUG> Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: select_content, {
    "_dbg" = 1;
    "_o" = app;
    "_r" = 1;
    "_sc" = MoreViewController;
    "_si" = "-3358907490504482271";
    "content_type" = button;
    "item_id" = "id-1";
    "item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
}
2017-02-22 13:47:12.021 NotKarltonBanks[1537:] <FIRAnalytics/DEBUG> Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: select_content, {
        "_dbg" = 1;
        "_o" = app;
        "_r" = 1;
        "_sc" = MoreViewController;
        "_si" = "-3358907490504482271";
        "content_type" = button;
        "item_id" = "id-1";
        "item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
    }
2017-02-22 13:47:12.048798 NotKarltonBanks[1537:425305] current page 0
2017-02-22 13:47:12.054340 NotKarltonBanks[1537:425305] current page 0
2017-02-22 13:47:12.101634 NotKarltonBanks[1537:425489] <FIRAnalytics/DEBUG> Event logged. Event name, event params: select_content, {
    "_dbg" = 1;
    "_o" = app;
    "_r" = 1;
    "_sc" = MoreViewController;
    "_si" = "-3358907490504482271";
    "content_type" = button;
    "item_id" = "id-1";
    "item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
}

Here is my code:

- (IBAction)aboutURL:(id)sender {

    [FIRAnalytics logEventWithName:kFIREventSelectContent
                        parameters:@{
                                     kFIRParameterItemID:[NSString stringWithFormat:@"id-1"],
                                     kFIRParameterItemName:@"Tapped Not Karlton Keyboard Tutorial Button",
                                     kFIRParameterContentType:@"button"
                                     }];


    KeyboardTutorialViewController *keyboardTutorialViewController = [[KeyboardTutorialViewController alloc] init];
    [self.navigationController pushViewController:keyboardTutorialViewController animated:YES];

}
Laurence Wingo
  • 3,912
  • 7
  • 33
  • 61

1 Answers1

1

It looks like XCode 8 is very verbose and it logs the same message twice. You can turn off duplicate logs by using the flag OS_ACTIVITY_MODE = disable.

adbitx
  • 2,019
  • 8
  • 13
  • For reference, to add this: go to Product -> Scheme -> Edit Scheme, pick Run on the left hand side, go to Arguments tab and add `OS_ACTIVITY_MODE` as an environment variable with value `disable`. – Vlad V Mar 04 '17 at 16:42