@@ -44,16 +44,24 @@ - (void)sensorsabtest_trackEvent:(NSMutableDictionary *)event isSignUp:(BOOL)isS
4444 tempEvent = [event mutableCopy ];
4545 }
4646
47+ // 用于移除 properties 中的 loginId, distinctId,anonymousId
48+ NSMutableDictionary *tempProperties = [properties mutableCopy ];
49+
4750 // 修改 loginId, distinctId,anonymousId
48- tempEvent[kSALoginId ] = properties[kSABLoginId ];
49- tempEvent[kSADistinctId ] = properties[kSABDistinctId ];
50- tempEvent[kSAAnonymousId ] = properties[kSABAnonymousId ];
51+ if (properties[kSABLoginId ]) {
52+ tempEvent[kSALoginId ] = properties[kSABLoginId ];
53+ tempProperties[kSABLoginId ] = nil ;
54+ }
5155
52- // properties 中 移除 loginId, distinctId,anonymousId
53- NSMutableDictionary *tempProperties = [properties mutableCopy ];
54- tempProperties[kSABLoginId ] = nil ;
55- tempProperties[kSABDistinctId ] = nil ;
56- tempProperties[kSABAnonymousId ] = nil ;
56+ if (properties[kSABDistinctId ]) {
57+ tempEvent[kSADistinctId ] = properties[kSABDistinctId ];
58+ tempProperties[kSABDistinctId ] = nil ;
59+ }
60+
61+ if (properties[kSABAnonymousId ]) {
62+ tempEvent[kSAAnonymousId ] = properties[kSABAnonymousId ];
63+ tempProperties[kSABAnonymousId ] = nil ;
64+ }
5765
5866 tempEvent[kSAProperties ] = tempProperties;
5967 [self sensorsabtest_trackEvent: tempEvent isSignUp: isSignUp];
0 commit comments