Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method signature incorrect for setScreenName() #130

Open
inorganik opened this issue Oct 14, 2022 · 2 comments
Open

Method signature incorrect for setScreenName() #130

inorganik opened this issue Oct 14, 2022 · 2 comments

Comments

@inorganik
Copy link

Describe the bug
The typing for setScreenName() is incorrect. It shows the nameOverride property as optional, but it is not:

setScreenName(options: {
      screenName: string;
      nameOverride?: string;
  }): Promise<void>;

If it is omitted, Xcode logs errors for every setScreenName() call, and Analytics DebugView will not show that it received any screen_view events. Errors look like this:

2022-10-14 17:07:43.621470-0600 App[6719:1746615] 8.15.0 - [Firebase/Analytics][I-ACS013000] Screen parameter value must be of type NSString: (nil)
2022-10-14 17:07:43.621767-0600 App[6719:1746615] 8.15.0 - [Firebase/Analytics][I-ACS031028] Received invalid class for screen: (nil)

Those 2 logs appear for each call to setScreenName() that does not include the nameOverride property.

To Reproduce
In your app, call the method without the nameOverride property:

setScreenName(screenName: string): void {
    FirebaseAnalytics.setScreenName({ screenName });
  }

Expected behavior
The method signature should require the nameOverride property.

Desktop (please complete the following information):

  • OS: 12.6
  • Browser: Chrome
  • Version: 106

Smartphone (please complete the following information):

  • Device: iOS simulator - iPhone 12 Pro Max
  • OS: 14
  • Browser: Safari
@joeczucha
Copy link

joeczucha commented Nov 16, 2022

Just ran into this ourselves. The screen_view events were still appearing in Firebase Analytics but firebase_screen parameter was empty until we added a value for nameOverride.

@jcesarmobile
Copy link
Contributor

A comment in the code seems to indicate that not passing nameOverride is used to clear the screen name, but it's true that on iOS you'll get a firebase error message saying that nil is invalid. On Android it doesn't complain about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants