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 Segment.io SDK does not allow null in Event's properties #852

Closed
abodnyaUA opened this issue Nov 13, 2019 · 5 comments
Closed

iOS Segment.io SDK does not allow null in Event's properties #852

abodnyaUA opened this issue Nov 13, 2019 · 5 comments

Comments

@abodnyaUA
Copy link

We use the SDK to send analytics on Segment.io by calling
[SEGAnalytics - (void)track:(NSString *)event properties:(SERIALIZABLE_DICT _Nullable)properties] method. This method uses SEGCoerceJSONObject method to serialize properties in JSON and during the serialization, it drops all the NSNull values.
Because of this we cannot send as a properties a dictionary with the value for key equals null, for example { "name": null }

Android's implementation of Segment.io SDK ALLOWS sending null values.

In the comment of SEGCoerceJSONObject method it says that dropping NSNull is a HOTFIX
// Hotfix for issue where SEGFileStorage uses plist which does NOT support NSNull
This "HOTFIX" was added more than 2 years ago in the pr #707

Could you please provide normal fix for the issue and stop dropping NSNull values?
The iOS SDK is inconsistent with Android one and behave differently.

Thanks!

@abodnyaUA
Copy link
Author

@bsneed
Copy link
Contributor

bsneed commented Nov 18, 2019

Switched the underlying storage from plist to json. Null's are now coming across correctly. PR to be attached shortly.

@abodnyaUA
Copy link
Author

@bsneed, wait for the pull-request. Thanks!

@bsneed
Copy link
Contributor

bsneed commented Nov 27, 2019

Fixed, but leaving this open until we roll out another release soon.

@bsneed
Copy link
Contributor

bsneed commented Jan 30, 2020

Released in 3.8.0-beta.1

colinking added a commit to segmentio/typewriter that referenced this issue Apr 5, 2020
`analytics-ios` recently released support for serializing `null` values in the request sent to the Segment Tracking API: segmentio/analytics-ios#852

This was released as `v3.8.0-beta.1`. For folks using typewriter + `analytics-ios` of at least that version, null values for required fields will now be serialized. Optional fields set to `nil` continue to be removed before serialization.

Fixes #114
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

2 participants