react-native-firebase-analytics icon indicating copy to clipboard operation
react-native-firebase-analytics copied to clipboard

[iOS] <FIRAnalytics/WARNING> setScreenName:screenClass: must be called after a view controller has appeared

Open dieppe opened this issue 8 years ago • 7 comments

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.

dieppe avatar Feb 14 '17 10:02 dieppe

Did you manage to get around this?

damir-sirola avatar Mar 21 '17 10:03 damir-sirola

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.

dieppe avatar Mar 21 '17 11:03 dieppe

I am using this but i dont see the value of the screen name I send, it's always MainActivity on the console.

annelorraineuy avatar Mar 30 '17 00:03 annelorraineuy

Yeah, got the same error :(

Maybe a workaround could be: firebase.analytics().logEvent('screen_profile');

Twinski avatar Jun 23 '17 18:06 Twinski

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

jordanmkoncz avatar Jul 13 '17 03:07 jordanmkoncz

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

adgarcia avatar Jul 21 '17 22:07 adgarcia

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?

newuser44 avatar Sep 07 '18 13:09 newuser44