ios - Firebase Analytics 多次触发

标签 ios swift firebase-analytics

完成 Firebase 的 Analytics 教程以添加 Analytics 后,我能够看到示例代码在将其添加到我的应用程序后正常工作。为了对其进行测试,我将分析事件添加到 IBAction 方法中,以便在点击特定按钮时使用。问题是,当我查看打开调试选项进行分析的控制台时,它显示事件多次触发。为什么会这样?

这是调试控制台日志:

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";
}

这是我的代码:

- (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];

}

最佳答案

看起来 XCode 8 非常冗长,它记录了相同的消息两次。您可以使用标志 OS_ACTIVITY_MODE = disable 来关闭重复日志。

关于ios - Firebase Analytics 多次触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42400134/

相关文章:

ios - 如果应用程序在后台调用 iOS Twilio 客户端时获取死气

ios - touchesBegan :withEvent: on UIView in UITableViewCell called with noticable delay

swift - 传入从另一个 tableviewcontroller 接收到的字符串

ios - 导航 Controller :willShowViewController:animated: is not called after popToRootViewControllerAnimated in presented view controller

ios - Firebase 打印 Analytics SSL 错误,但未使用 Analytics

iOS:如何从 tableview 的自定义单元格中的 UITextField 访问值

html - 这是从 iOS 上的网站提取数据的合法/安全方式吗?

ios - Swift JSONDecoder 解码(类型 :from) does not recognize my data

android - Firebase 显示错误的用户数量(因为我的应用未发布)

android - 如果我的项目链接到Firebase,如何集成Google Analytics(分析)?