[iOS] <FIRAnalytics/WARNING> setScreenName:screenClass: must be called after a view controller has appeared
Each time I try to call setScreenName I get the following warning:
<FIRAnalytics/WARNING> setScreenName:screenClass: must be called after a view controller has appeared
To get the warning you have to first set FirebaseAutomaticScreenReportingEnabled to NO in the Info.plist.
Afaict no screen event is sent when the warning appears.
Did you manage to get around this?
Nope, we don't really use this feature right now (it's kinda buried in the console...) so I did not have time to dedicate to this.
I am using this but i dont see the value of the screen name I send, it's always MainActivity on the console.
Yeah, got the same error :(
Maybe a workaround could be: firebase.analytics().logEvent('screen_profile');
I'm having the same warning appearing as well every time I try to call setScreenName. I'm testing in the iOS simulator, and I'm not seeing any screen name events appearing in the Firebase Console.
My Environment
| software | version |
|---|---|
| react-native-firebase-analytics | 3.0.1 |
| react-native | 0.41.2 |
so, I think this is happening because the RN view lifecycle doesn't really match up that well w/ the ViewController life cycle. I've had better luck calling setScreenName inside a timeout, but that's also not a great solution. It really needs to be tied to the -viewDidAppear: method
afaik this isn't an issue w/ the library; you can wrap the FIRAnalytics method yourself and, if you call it from componentDidMount or render, you'll see this error message every(?) time
Anybody get this working for Ionic apps? We can't seem to see any screenNames in firebase for ios. All I can find is old posts from over a year ago with no real solution.
https://github.com/arnesson/cordova-plugin-firebase/issues/828
How have you got this working with a timeout?