2017-02-22 74 views
0

在完成Firebase Analytics分析教程以添加Google Analytics後,我可以在將示例代碼添加到我的應用後看到示例代碼。爲了進行測試,我將分析事件添加到IBAction方法中,以便在特定按鈕被點擊時使用。問題是,當我查看帶有用於分析的調試選項的控制檯時,它顯示多次觸發事件。爲什麼會發生這種情況?Firebase Analytics多次觸發

這裏是調試控制檯日誌:

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

} 

回答

1

它看起來像的XCode 8是非常冗長,兩次記錄相同的消息。您可以使用標誌OS_ACTIVITY_MODE = disable關閉重複日誌。

+0

作爲參考,添加:進入產品 - >方案 - >編輯方案,選擇左側的運行,轉到參數選項卡,並添加'OS_ACTIVITY_MODE'作爲值爲'disable'的環境變量。 –