问题
I try to use Screen Tracking feature of Firebase Analytics.
Here's the code of a screen in my app. I'd like to track transitions to this screen, and set the original screen name in 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.
}
But Even though I made screen transition only once, screen_view
event is called twice.
1st:
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;
}
2nd:
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;
}
Both are called within about 1 sec. 1st has no firebase_screen
key, and 2nd has the same class name in firebase_previous_class
key.
Is it a Firebase specification? Or is there any mistake in my code?
回答1:
From Firebase team: This case would happen for view controllers that contained other view controllers (parent-child relationship) so there is nothing wrong with your code.
来源:https://stackoverflow.com/questions/46931632/firebase-screen-tracking-calls-screen-view-event-twice