Skip to content

Conversation

@mmustafa-tse
Copy link
Contributor

@mmustafa-tse mmustafa-tse commented Sep 8, 2022

Summary

A client noticed in their iOS React Native app that user attributes with empty string are not being set. We confirmed that custom feeds, Web SDK and Android SDK (in both original SDK and React Native) are forwarding the attribute as expected when the string is empty. We were able to identify that this issue is on the iOS SDK and not React Native SDK itself when testing. The code here adds the necessary fixes to allow empty string attributes to not be considered an invalid data type and would forward as the same other SDKs.

Testing Plan

Changed the files locally on my sample app in the mParticle iOS SDK and tested with my sample app.

@samdozor samdozor requested a review from a team as a code owner October 13, 2025 16:59
[MPListenerController.sharedInstance onAPICalled:_cmd parameter1:key parameter2:value];

if ([value isKindOfClass:[NSString class]] && (((NSString *)value).length <= 0)) {
if ([value isKindOfClass:[NSString class]] && (((NSString *)value).length < 0)) {
Copy link
Contributor

@denischilik denischilik Oct 15, 2025

Choose a reason for hiding this comment

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

I think this check (((NSString *)value).length < 0) can be removed at all because length can't be negative

}

if (!(([value isKindOfClass:[NSString class]] && ((NSString *)value).length > 0) || [value isKindOfClass:[NSNumber class]]) && value != nil) {
if (!(([value isKindOfClass:[NSString class]] && ((NSString *)value).length >= 0) || [value isKindOfClass:[NSNumber class]]) && value != nil) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic look strange to me looks like it can be simplified to
if (!( [value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSNumber class]] ))

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.

2 participants