I want to understand the warning I am getting from Firbase IOS
<FIRAnalytics/WARNING> setScreenName:screenClass: must be called after a view controller has appeared
My info.plist contains
FirebaseAutomaticScreenReportingEnabled = NO
I am calling
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
recordScreenView()
}
func recordScreenView() {
// title from the story board
// These strings must be <= 36 characters long in order for setScreenName:screenClass: to succeed.
guard let screenName = title else {
return
}
let screenClass = classForCoder.description()
// [START set_current_screen]
GCITracking.sharedInstance.trackSetScreenName(screenName, screenClass: screenClass)
// [END set_current_screen]
}
code taken from sample app
I am not seeing my screen event as expected but I am not sure whether this has anything to do with my code or is a GTM configuration issue.
I found the warning message ambigious
Just faced this problem with a GTM + Firebase implementation and made the warning disappear simply by calling this method in the viewDidAppear method :
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated);
// ...
Analytics.setScreenName(screenName, screenClass: screenClass)
}
}
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With