Closed zenled closed 2 years ago
@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?
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...
).
Fixes a bug on iOS, where Segment would not report correctly when calling
identify
withuserId: null
.Explanation: in iOS when
userId
is obtained from arguments it might beNSNull
, but the Segment library expects it to benil
. Added a line to convertuserId
fromNSNull
tonil
.Related issue Identify userId is optional but the implementation does not reflect this.