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

[iOS] Fix userId nil #28

Merged
merged 1 commit into from
Jun 9, 2022

Conversation

zenled
Copy link
Contributor

@zenled zenled commented May 12, 2022

Fixes a bug on iOS, where Segment would not report correctly when calling identify with userId: null.

Explanation: in iOS when userId is obtained from arguments it might be NSNull, but the Segment library expects it to be nil. Added a line to convert userId from NSNull to nil.

Related issue Identify userId is optional but the implementation does not reflect this.

Copy link
Contributor

@cdmunoz cdmunoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a first glance, LGTM 👌🏻

First we need to check if the workflows run successfully.

@danielgomezrico
Copy link
Contributor

@zenled thanks for the contribution, I have a question, when you say would not report correctly how does it report it?
Can you show some logs or events created in segment to understand better the issue?

@zenled
Copy link
Contributor Author

zenled commented May 26, 2022

To explain the problem a bit further:

// Dart
await Segment.identify(userId: null, traits: {'firstName': 'John'});

Of the iOS side after the line NSString *userId = call.arguments[@"userId"]; the userId is NSNull.
The problem is that the identify method expects it to be NSString or nil.

My fix converts the NSNull to nil.

Without the fix, the native Segment library throws (exception NSException * @"-[NSNull length]: unrecognized selector sent to instance...).

@danielgomezrico danielgomezrico self-requested a review June 9, 2022 19:44
Copy link
Contributor

@danielgomezrico danielgomezrico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for opening the PR!

@danielgomezrico danielgomezrico merged commit c4ea075 into la-haus:master Jun 9, 2022
@zenled zenled deleted the la-haus/fix/ios-userid-nil branch June 10, 2022 07:25
saigkl pushed a commit to saigkl/firebase_seg that referenced this pull request Jul 27, 2022
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

Successfully merging this pull request may close these issues.

3 participants