File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,11 +49,8 @@ - (instancetype)init {
4949 _serialQueue = dispatch_queue_create ([serialQueueLabel UTF8String ], DISPATCH_QUEUE_SERIAL);
5050 [self resgisterStorePlugins ];
5151
52- /* 读取本地缓存前,需要先读取自定义主体 ID
53- 如果读取为 nil,初始化空 Dictionary,方便后续使用 isEqualToDictionary: 判断
54- */
55- _customIDs = [[SABStoreManager sharedInstance ] dictionaryForKey: kSABCustomIDsFileName ] ?: [NSDictionary dictionary ];
56-
52+ // 读取本地缓存前,需要先读取自定义主体 ID
53+ _customIDs = [[SABStoreManager sharedInstance ] dictionaryForKey: kSABCustomIDsFileName ];
5754
5855 // 读取本地缓存
5956 [self unarchiveExperimentResult ];
@@ -119,8 +116,11 @@ - (void)unarchiveExperimentResult {
119116 SABFetchResultResponse *resultResponse = (SABFetchResultResponse *)result;
120117 NSString *distinctId = [SABBridge distinctId ];
121118 NSDictionary *customIDs = resultResponse.userIdenty .customIDs ;
119+ // 校验 customIDs
120+ BOOL isSameCustomIDs = (customIDs.count == 0 && self.customIDs .count == 0 ) || [customIDs isEqualToDictionary: self .customIDs];
122121 // 校验缓存试验的 distinctId
123- if ([resultResponse.userIdenty.distinctId isEqualToString: distinctId] && [customIDs isEqualToDictionary: self .customIDs] && resultResponse.results .count > 0 ) {
122+ BOOL isSameDistinctId = [resultResponse.userIdenty.distinctId isEqualToString: distinctId];
123+ if (isSameDistinctId && isSameCustomIDs && resultResponse.results .count > 0 ) {
124124 self.resultResponse = resultResponse;
125125 SABLogInfo (@" unarchiveExperimentResult success jsonObject %@ " , resultResponse.responseObject );
126126 }
Original file line number Diff line number Diff line change @@ -53,13 +53,15 @@ - (void)encodeWithCoder:(nonnull NSCoder *)coder {
5353 [coder encodeObject: self .distinctId forKey: @" distinctId" ];
5454 [coder encodeObject: self .loginId forKey: @" loginId" ];
5555 [coder encodeObject: self .anonymousId forKey: @" anonymousId" ];
56+ [coder encodeObject: self .customIDs forKey: @" customIDs" ];
5657}
5758
5859- (nullable instancetype )initWithCoder : (nonnull NSCoder *)coder {
5960 if (self = [super init ]) {
6061 self.distinctId = [coder decodeObjectForKey: @" distinctId" ];
6162 self.loginId = [coder decodeObjectForKey: @" loginId" ];
6263 self.anonymousId = [coder decodeObjectForKey: @" anonymousId" ];
64+ self.customIDs = [coder decodeObjectForKey: @" customIDs" ];
6365 }
6466 return self;
6567}
Original file line number Diff line number Diff line change 2525#import " SABConstants.h"
2626
2727// 当前版本号
28- NSString *const kSABLibVersion = @" 0.2.1 " ;
28+ NSString *const kSABLibVersion = @" 0.2.2 " ;
2929
3030// SA 最低支持版本
3131NSString *const kSABMinSupportedSALibVersion = @" 4.2.0" ;
Original file line number Diff line number Diff line change 11Pod ::Spec . new do |s |
22 s . name = 'SensorsABTesting'
3- s . version = "0.2.1 "
3+ s . version = "0.2.2 "
44 s . summary = 'The official iOS/macOS SDK of Sensors A/B Testing.'
55 s . homepage = 'http://www.sensorsdata.cn'
66 s . license = { :type => 'Apache 2.0' , :file => 'LICENSE' }
You can’t perform that action at this time.
0 commit comments