Rya*_*ner 7 ios firebase google-tag-manager
我想了解我从 Firbase IOS 收到的警告
<FIRAnalytics/WARNING> setScreenName:screenClass: must be called after a view controller has appeared
Run Code Online (Sandbox Code Playgroud)
我的 info.plist 包含
FirebaseAutomaticScreenReportingEnabled = NO
Run Code Online (Sandbox Code Playgroud)
我在打电话
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]
}
Run Code Online (Sandbox Code Playgroud)
从示例应用程序中获取的代码
我没有按预期看到我的屏幕事件,但我不确定这是否与我的代码有关还是 GTM 配置问题。
我发现警告信息模棱两可
刚刚在 GTM + Firebase 实现中遇到了这个问题,只需在viewDidAppear方法中调用此方法即可使警告消失:
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)
}
}
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助。
| 归档时间: |
|
| 查看次数: |
5333 次 |
| 最近记录: |