evollu / react-native-firebase-analytics

React native bridge for firebase analytics
MIT License
206 stars 54 forks source link

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

Open dieppe opened 7 years ago

dieppe commented 7 years ago

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.

damir-sirola commented 7 years ago

Did you manage to get around this?

dieppe commented 7 years ago

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.

annelorraineuy commented 7 years ago

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

Twinski commented 7 years ago

Yeah, got the same error :(

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

jordanmkoncz commented 7 years ago

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
adgarcia commented 6 years ago

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

newuser44 commented 5 years ago

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?