analytics-ios icon indicating copy to clipboard operation
analytics-ios copied to clipboard

Identify `userId` is optional but the implementation does not reflect this

Open danielgomezrico opened this issue 3 years ago • 5 comments

This validation does not work if the userId is null: https://github.com/segmentio/analytics-ios/blob/master/Segment/Classes/SEGAnalytics.m#L272

But here it is checked: https://github.com/segmentio/analytics-ios/blob/master/Segment/Classes/SEGAnalytics.m#L293

It is defined as optional on https://segment.com/docs/connections/sources/catalog/libraries/mobile/ios/#identify image

I found this because the flutter implementation of segment (https://github.com/claimsforce-gmbh/flutter-segment/pull/59) allowed userId to be null, but it throws this error:

-[NSNull length]: unrecognized selector sent to instance 0x1db450558

danielgomezrico avatar Dec 17 '21 22:12 danielgomezrico

Any updates here? Have you had success passing an empty string? Why have you closed that PR on the flutter_segment repo?

HerrNiklasRaab avatar Mar 01 '22 15:03 HerrNiklasRaab

@HerrNiklasRaab It was closed because that repo became deprecated, now that library works in https://github.com/la-haus/flutter-segment.

The issue is still there, but from the library we send an empty string to it, it does not seem like the best way to do it :(

danielgomezrico avatar Mar 01 '22 20:03 danielgomezrico

Hey thx for the response, but does it work? Have you found any drawbacks with it?

Daniel Gomez @.***> schrieb am Di. 1. März 2022 um 21:22:

@HerrNiklasRaab https://github.com/HerrNiklasRaab It was closed because that repo became deprecated, now that library works in https://github.com/la-haus/flutter-segment.

The issue is still there, but from the library we send an empty string to it, it does not seem like the best way to do it :(

— Reply to this email directly, view it on GitHub https://github.com/segmentio/analytics-ios/issues/1024#issuecomment-1055825970, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGYV7OPNN2CG73OKELBKSXLU5Z4A3ANCNFSM5KJZV75A . You are receiving this because you were mentioned.Message ID: @.***>

-- Niklas Raab

CTO - Geschäftsführer

CodingPassion GmbH +49 (0) 1575 2589725 <+49+(0)+1575+2589725> @.*** codingpassion.net 83064 Raubling, Inntalstr. 3 [image: linkedin] https://www.linkedin.com/in/niklas-raab/ Create Your Own Free Signature https://www.hubspot.com/email-signature-generator?utm_source=create-signature

HerrNiklasRaab avatar Mar 01 '22 20:03 HerrNiklasRaab

I haven't found drawbacks, but if you find them, let me know

danielgomezrico avatar Mar 02 '22 12:03 danielgomezrico

Hey, I stumbled upon the same issue when using flutter-segment. The cause of this issue is not in this library but in the flutter-segment library. Here is a fix: https://github.com/la-haus/flutter-segment/pull/28

zenled avatar May 12 '22 07:05 zenled