diff --git a/Sources/Classes/RSClient.m b/Sources/Classes/RSClient.m index 645af265..3cc6a058 100644 --- a/Sources/Classes/RSClient.m +++ b/Sources/Classes/RSClient.m @@ -236,10 +236,7 @@ - (void) alias:(NSString *)newId options:(RSOption *) options { RSContext *rc = [RSElementCache getContext]; NSMutableDictionary* traits = [rc.traits mutableCopy]; - NSObject *prevId = [traits objectForKey:@"userId"]; - if(prevId == nil) { - prevId =[traits objectForKey:@"id"]; - } + NSObject *prevId = [traits objectForKey:@"userId"] ?: [traits objectForKey:@"id"] ?: self.anonymousId; traits[@"id"] = newId; traits[@"userId"] = newId;