Firebase Screen Tracking两次调用“screen_view”事件

时间:2017-10-25 11:47:33

标签: ios swift firebase firebase-analytics

我尝试使用Firebase Analytics的屏幕跟踪功能 这是我的应用程序中的屏幕代码。我想跟踪转换到此屏幕,并在viewDidAppear中设置原始屏幕名称。

import UIKit
import Firebase

class Section1412: UIViewController {

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(true)
        Analytics.setScreenName("Sceeen1.4.1.2", screenClass: "Section1412")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

但即使我只进行了一次屏幕转换,screen_view事件也会被调用两次。

第一

2017-10-25 20:16:49.109820+0900 iOSTestApp[14863:709645]Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: screen_view (_vs), 
{
    firebase_event_origin (_o) = auto;
    firebase_realtime (_r) = 1;
    firebase_screen_class (_sc) = Section1412;
    firebase_debug (_dbg) = 1;
    firebase_screen_id (_si) = 6534403927247648702;
    firebase_previous_class (_pc) = NativeTableViewController;
    firebase_previous_id (_pi) = 6534403927247648701;
}  

第二

2017-10-25 20:16:49.115297+0900 iOSTestApp[14863:709645] [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: screen_view (_vs),
{
    firebase_event_origin (_o) = auto;
    firebase_screen (_sn) = Screen1.4.1.2;
    firebase_realtime (_r) = 1;
    firebase_screen_class (_sc) = Section1412;
    firebase_debug (_dbg) = 1;
    firebase_screen_id (_si) = 6534403927247648703;
    firebase_previous_class (_pc) = Section1412;
    firebase_previous_id (_pi) = 6534403927247648702;
}  

两者都在大约1秒内被召唤。 1st没有firebase_screen键,2nd在firebase_previous_class键中具有相同的类名 它是Firebase规范吗?或者我的代码中有任何错误吗?

1 个答案:

答案 0 :(得分:2)

来自Firebase团队:对于包含其他视图控制器(父子关系)的视图控制器,会出现这种情况,因此您的代码没有任何问题。