完成 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/