From 2213c0f7f78335d24045d45992b1a2b58136d6d6 Mon Sep 17 00:00:00 2001 From: Mo Mustafa Date: Thu, 8 Sep 2022 14:03:31 -0700 Subject: [PATCH] Allow user attributes with empty string values to be set --- mParticle-Apple-SDK/Identity/MParticleUser.m | 2 +- mParticle-Apple-SDK/MPBackendController.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mParticle-Apple-SDK/Identity/MParticleUser.m b/mParticle-Apple-SDK/Identity/MParticleUser.m index e0393c46..a70384bf 100644 --- a/mParticle-Apple-SDK/Identity/MParticleUser.m +++ b/mParticle-Apple-SDK/Identity/MParticleUser.m @@ -279,7 +279,7 @@ - (nullable NSNumber *)incrementUserAttribute:(NSString *)key byValue:(NSNumber - (void)setUserAttribute:(nonnull NSString *)key value:(nonnull id)value { [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)) { MPILogDebug(@"User attribute not updated. Please use removeUserAttribute."); return; diff --git a/mParticle-Apple-SDK/MPBackendController.mm b/mParticle-Apple-SDK/MPBackendController.mm index cd8c3917..7b7b7116 100644 --- a/mParticle-Apple-SDK/MPBackendController.mm +++ b/mParticle-Apple-SDK/MPBackendController.mm @@ -2037,7 +2037,7 @@ - (void)setUserAttribute:(NSString *)key value:(id)value timestamp:(NSDate *)tim return; } - 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) { if (completionHandler) { completionHandler(keyCopy, value, MPExecStatusInvalidDataType); }