From b2278ecbd36c9883689281ba9a7f2d330fe3e617 Mon Sep 17 00:00:00 2001 From: jg zhu <13913514919@189.cn> Date: Wed, 18 Aug 2021 18:48:01 +0800 Subject: [PATCH] Release 3.1.2 --- SensorsAnalyticsSDK.podspec | 2 +- .../AutoTrack/AppClick/UIView+AutoTrack.m | 8 ++-- SensorsAnalyticsSDK/Core/SAModuleManager.m | 2 +- .../Core/SensorsAnalyticsSDK.m | 2 +- .../ElementPath/UIView+SAElementPath.m | 47 +++++++++++-------- 5 files changed, 34 insertions(+), 27 deletions(-) diff --git a/SensorsAnalyticsSDK.podspec b/SensorsAnalyticsSDK.podspec index 9caf834c..b14a1212 100644 --- a/SensorsAnalyticsSDK.podspec +++ b/SensorsAnalyticsSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SensorsAnalyticsSDK" - s.version = "3.1.1" + s.version = "3.1.2" s.summary = "The official iOS SDK of Sensors Analytics." s.homepage = "http://www.sensorsdata.cn" s.source = { :git => 'https://github.com/sensorsdata/sa-sdk-ios.git', :tag => "v#{s.version}" } diff --git a/SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+AutoTrack.m b/SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+AutoTrack.m index f48ca6d2..c2770e89 100644 --- a/SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+AutoTrack.m +++ b/SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+AutoTrack.m @@ -127,11 +127,11 @@ - (NSString *)sensorsdata_elementContent { } - (NSString *)sensorsdata_elementPosition { - UIView *superview = self.superview; - if (superview && superview.sensorsdata_elementPosition) { - return superview.sensorsdata_elementPosition; + UIView *superView = self.superview; + if (!superView) { + return nil; } - return nil; + return superView.sensorsdata_elementPosition; } - (NSString *)sensorsdata_elementId { diff --git a/SensorsAnalyticsSDK/Core/SAModuleManager.m b/SensorsAnalyticsSDK/Core/SAModuleManager.m index 97feffd4..352405c3 100644 --- a/SensorsAnalyticsSDK/Core/SAModuleManager.m +++ b/SensorsAnalyticsSDK/Core/SAModuleManager.m @@ -162,7 +162,7 @@ - (void)setEnable:(BOOL)enable forModule:(NSString *)moduleName { } else { NSString *className = [self classNameForModule:moduleName]; Class cla = NSClassFromString(className); - NSAssert(cla, @"\n您使用接口开启了 %@ 模块,但是并没有集成该模块。\n • 如果使用源码集成神策分析 iOS SDK,请检查是否包含名为 %@ 的文件?\n • 如果使用 CocoaPods 集成 SDK,请修改 Podfile 文件,增加 %@ 模块的 subspec,例如:pod 'SensorsAnalyticsSDK', :subspecs => ['%@']。\n", moduleName, className, moduleName, moduleName); + NSAssert(cla, @"\n您使用接口开启了 %@ 模块,但是并没有集成该模块。\n • 如果使用源码集成神策分析 iOS SDK,请检查是否包含名为 %@ 的文件?\n • 如果使用 CocoaPods 集成 SDK,请修改 Podfile 文件,增加 %@ 模块的 subspec,例如:pod 'SensorsAnalyticsSDK', :subspecs => ['Core', '%@']。\n", moduleName, className, moduleName, moduleName); if ([cla conformsToProtocol:@protocol(SAModuleProtocol)]) { id object = [[(Class)cla alloc] init]; if ([object respondsToSelector:@selector(setConfigOptions:)]) { diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m index c6910b34..54c034d8 100755 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m @@ -41,7 +41,7 @@ #import "SAProfileEventObject.h" #import "SAJSONUtil.h" -#define VERSION @"3.1.1" +#define VERSION @"3.1.2" void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag; diff --git a/SensorsAnalyticsSDK/Visualized/ElementPath/UIView+SAElementPath.m b/SensorsAnalyticsSDK/Visualized/ElementPath/UIView+SAElementPath.m index a213d78f..e4afdfa3 100644 --- a/SensorsAnalyticsSDK/Visualized/ElementPath/UIView+SAElementPath.m +++ b/SensorsAnalyticsSDK/Visualized/ElementPath/UIView+SAElementPath.m @@ -227,9 +227,8 @@ - (NSString *)sensorsdata_heatMapPath { - (NSString *)sensorsdata_similarPath { // 是否支持限定元素位置功能 BOOL enableSupportSimilarPath = [NSStringFromClass(self.class) isEqualToString:@"UITabBarButton"]; - if (self.sensorsdata_elementPosition && enableSupportSimilarPath) { - NSString *similarPath = [NSString stringWithFormat:@"%@[-]",NSStringFromClass(self.class)]; - return similarPath; + if (enableSupportSimilarPath && self.sensorsdata_elementPosition) { + return [NSString stringWithFormat:@"%@[-]",NSStringFromClass(self.class)]; } else { return self.sensorsdata_itemPath; } @@ -650,22 +649,25 @@ - (NSIndexPath *)sensorsdata_IndexPath { #pragma mark SAAutoTrackViewPathProperty - (NSString *)sensorsdata_itemPath { - if (self.sensorsdata_IndexPath) { - return [self sensorsdata_itemPathWithIndexPath:self.sensorsdata_IndexPath]; + NSIndexPath *indexPath = self.sensorsdata_IndexPath; + if (indexPath) { + return [self sensorsdata_itemPathWithIndexPath:indexPath]; } return [super sensorsdata_itemPath]; } - (NSString *)sensorsdata_similarPath { - if (self.sensorsdata_IndexPath) { - return [self sensorsdata_similarPathWithIndexPath:self.sensorsdata_IndexPath]; + NSIndexPath *indexPath = self.sensorsdata_IndexPath; + if (indexPath) { + return [self sensorsdata_similarPathWithIndexPath:indexPath]; } return self.sensorsdata_itemPath; } - (NSString *)sensorsdata_heatMapPath { - if (self.sensorsdata_IndexPath) { - return [self sensorsdata_itemPathWithIndexPath:self.sensorsdata_IndexPath]; + NSIndexPath *indexPath = self.sensorsdata_IndexPath; + if (indexPath) { + return [self sensorsdata_itemPathWithIndexPath:indexPath]; } return [super sensorsdata_heatMapPath]; } @@ -680,8 +682,9 @@ - (NSString *)sensorsdata_similarPathWithIndexPath:(NSIndexPath *)indexPath { #pragma mark SAAutoTrackViewProperty - (NSString *)sensorsdata_elementPosition { - if (self.sensorsdata_IndexPath) { - return [[NSString alloc] initWithFormat:@"%ld:%ld", (long)self.sensorsdata_IndexPath.section, (long)self.sensorsdata_IndexPath.row]; + NSIndexPath *indexPath = self.sensorsdata_IndexPath; + if (indexPath) { + return [NSString stringWithFormat:@"%ld:%ld", (long)indexPath.section, (long)indexPath.row]; } return nil; } @@ -705,23 +708,26 @@ - (NSIndexPath *)sensorsdata_IndexPath { #pragma mark SAAutoTrackViewPathProperty - (NSString *)sensorsdata_itemPath { - if (self.sensorsdata_IndexPath) { - return [self sensorsdata_itemPathWithIndexPath:self.sensorsdata_IndexPath]; + NSIndexPath *indexPath = self.sensorsdata_IndexPath; + if (indexPath) { + return [self sensorsdata_itemPathWithIndexPath:indexPath]; } return [super sensorsdata_itemPath]; } - (NSString *)sensorsdata_similarPath { - if (self.sensorsdata_IndexPath) { - return [self sensorsdata_similarPathWithIndexPath:self.sensorsdata_IndexPath]; + NSIndexPath *indexPath = self.sensorsdata_IndexPath; + if (indexPath) { + return [self sensorsdata_similarPathWithIndexPath:indexPath]; } else { return super.sensorsdata_similarPath; } } - (NSString *)sensorsdata_heatMapPath { - if (self.sensorsdata_IndexPath) { - return [self sensorsdata_itemPathWithIndexPath:self.sensorsdata_IndexPath]; + NSIndexPath *indexPath = self.sensorsdata_IndexPath; + if (indexPath) { + return [self sensorsdata_itemPathWithIndexPath:indexPath]; } return [super sensorsdata_heatMapPath]; } @@ -744,9 +750,10 @@ - (NSString *)sensorsdata_elementPosition { if (!elementInfo.isSupportElementPosition) { return nil; } - - if (self.sensorsdata_IndexPath) { - return [[NSString alloc] initWithFormat:@"%ld:%ld", (long)self.sensorsdata_IndexPath.section, (long)self.sensorsdata_IndexPath.item]; + + NSIndexPath *indexPath = self.sensorsdata_IndexPath; + if (indexPath) { + return [NSString stringWithFormat:@"%ld:%ld", (long)indexPath.section, (long)indexPath.item]; } return nil; }