Skip to content

Method signature incorrect for setScreenName() #130

Open
@inorganik

Description

@inorganik

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions