Skip to content

Commit

Permalink
Release 4.5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
王洋洋 committed Apr 12, 2023
1 parent ec3f650 commit 6a6ea5b
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 53 deletions.
12 changes: 6 additions & 6 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -566,7 +566,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand All @@ -583,7 +583,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 75FYWDWHL5;
INFOPLIST_FILE = "$(SRCROOT)/SensorsData/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -603,7 +603,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 75FYWDWHL5;
INFOPLIST_FILE = "$(SRCROOT)/SensorsData/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -622,7 +622,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 75FYWDWHL5;
INFOPLIST_FILE = SensorsDataSwift/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -644,7 +644,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 75FYWDWHL5;
INFOPLIST_FILE = SensorsDataSwift/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
24 changes: 12 additions & 12 deletions SensorsAnalyticsSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = "SensorsAnalyticsSDK"
s.version = "4.5.6"
s.version = "4.5.7"
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}" }
s.license = { :type => "Apache License, Version 2.0" }
s.author = { "Yuhan ZOU" => "zouyuhan@sensorsdata.cn" }
s.ios.deployment_target = '8.0'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.10'
s.default_subspec = 'Core'
s.frameworks = 'Foundation', 'SystemConfiguration'
Expand Down Expand Up @@ -47,7 +47,7 @@ Pod::Spec.new do |s|

# 全埋点
s.subspec 'AutoTrack' do |g|
g.ios.deployment_target = '8.0'
g.ios.deployment_target = '9.0'
g.dependency 'SensorsAnalyticsSDK/Common'
g.source_files = "SensorsAnalyticsSDK/AutoTrack/**/*.{h,m}"
g.public_header_files = 'SensorsAnalyticsSDK/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.h', 'SensorsAnalyticsSDK/AutoTrack/SAConfigOptions+AutoTrack.h'
Expand All @@ -56,15 +56,15 @@ Pod::Spec.new do |s|

# 可视化相关功能,包含可视化全埋点和点击图
s.subspec 'Visualized' do |f|
f.ios.deployment_target = '8.0'
f.ios.deployment_target = '9.0'
f.dependency 'SensorsAnalyticsSDK/AutoTrack'
f.source_files = "SensorsAnalyticsSDK/Visualized/**/*.{h,m}"
f.public_header_files = 'SensorsAnalyticsSDK/Visualized/SensorsAnalyticsSDK+Visualized.h', 'SensorsAnalyticsSDK/Visualized/SAConfigOptions+Visualized.h'
end

# 开启 GPS 定位采集
s.subspec 'Location' do |f|
f.ios.deployment_target = '8.0'
f.ios.deployment_target = '9.0'
f.frameworks = 'CoreLocation'
f.dependency 'SensorsAnalyticsSDK/Core'
f.source_files = "SensorsAnalyticsSDK/Location/**/*.{h,m}"
Expand All @@ -73,7 +73,7 @@ Pod::Spec.new do |s|

# 开启设备方向采集
s.subspec 'DeviceOrientation' do |f|
f.ios.deployment_target = '8.0'
f.ios.deployment_target = '9.0'
f.dependency 'SensorsAnalyticsSDK/Core'
f.source_files = 'SensorsAnalyticsSDK/DeviceOrientation/**/*.{h,m}'
f.public_header_files = 'SensorsAnalyticsSDK/DeviceOrientation/SensorsAnalyticsSDK+DeviceOrientation.h'
Expand All @@ -82,31 +82,31 @@ Pod::Spec.new do |s|

# 推送点击
s.subspec 'AppPush' do |f|
f.ios.deployment_target = '8.0'
f.ios.deployment_target = '9.0'
f.dependency 'SensorsAnalyticsSDK/Core'
f.source_files = "SensorsAnalyticsSDK/AppPush/**/*.{h,m}"
f.public_header_files = 'SensorsAnalyticsSDK/AppPush/SAConfigOptions+AppPush.h'
end

# 使用崩溃事件采集
s.subspec 'Exception' do |e|
e.ios.deployment_target = '8.0'
e.ios.deployment_target = '9.0'
e.dependency 'SensorsAnalyticsSDK/Common'
e.source_files = "SensorsAnalyticsSDK/Exception/**/*.{h,m}"
e.public_header_files = 'SensorsAnalyticsSDK/Exception/SAConfigOptions+Exception.h'
end

# 基于 UA,使用 UIWebView 或者 WKWebView 进行打通
s.subspec 'WebView' do |w|
w.ios.deployment_target = '8.0'
w.ios.deployment_target = '9.0'
w.dependency 'SensorsAnalyticsSDK/Core'
w.source_files = "SensorsAnalyticsSDK/WebView/**/*.{h,m}"
w.public_header_files = 'SensorsAnalyticsSDK/WebView/SensorsAnalyticsSDK+WebView.h'
end

# 基于 UA,使用 WKWebView 进行打通
s.subspec 'WKWebView' do |w|
w.ios.deployment_target = '8.0'
w.ios.deployment_target = '9.0'
w.dependency 'SensorsAnalyticsSDK/Core'
w.source_files = "SensorsAnalyticsSDK/WKWebView/**/*.{h,m}"
w.public_header_files = 'SensorsAnalyticsSDK/WKWebView/SensorsAnalyticsSDK+WKWebView.h'
Expand All @@ -119,14 +119,14 @@ Pod::Spec.new do |s|
end

s.subspec 'DeprecatedCellClick' do |d|
d.ios.deployment_target = '8.0'
d.ios.deployment_target = '9.0'
d.dependency 'SensorsAnalyticsSDK/Core'
d.source_files = 'CellClick_HookDelegate_Deprecated/*.{h,m}'
d.project_header_files = 'CellClick_HookDelegate_Deprecated/*.h'
end

s.subspec 'Exposure' do |h|
h.ios.deployment_target = '8.0'
h.ios.deployment_target = '9.0'
h.dependency 'SensorsAnalyticsSDK/Common'
h.source_files = 'SensorsAnalyticsSDK/Exposure/**/*.{h,m}'
h.public_header_files = 'SensorsAnalyticsSDK/Exposure/SAConfigOptions+Exposure.h', 'SensorsAnalyticsSDK/Exposure/SAExposureConfig.h', 'SensorsAnalyticsSDK/Exposure/SAExposureData.h', 'SensorsAnalyticsSDK/Exposure/SensorsAnalyticsSDK+Exposure.h', 'SensorsAnalyticsSDK/Exposure/UIView+ExposureIdentifier.h'
Expand Down
12 changes: 6 additions & 6 deletions SensorsAnalyticsSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3044,7 +3044,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -3100,7 +3100,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand All @@ -3126,7 +3126,7 @@
GENERATE_MASTER_OBJECT_FILE = YES;
INFOPLIST_FILE = "$(SRCROOT)/SupportingFiles/SensorsAnalyticsSDK-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -3161,7 +3161,7 @@
GENERATE_MASTER_OBJECT_FILE = YES;
INFOPLIST_FILE = "$(SRCROOT)/SupportingFiles/SensorsAnalyticsSDK-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -3187,7 +3187,7 @@
DEVELOPMENT_TEAM = 75FYWDWHL5;
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
INFOPLIST_FILE = SensorsAnalyticsTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -3205,7 +3205,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 75FYWDWHL5;
INFOPLIST_FILE = SensorsAnalyticsTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ - (void)sensorsdata_isValidPropertyKeyWithError:(NSError *__autoreleasing _Null
}

- (id)sensorsdata_propertyValueWithKey:(NSString *)key error:(NSError *__autoreleasing _Nullable *)error {
NSUInteger length = [self lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if (length > kSAPropertyValueMaxLength) {
SALogWarn(@"%@'s length is longer than %ld", self, kSAPropertyValueMaxLength);
NSInteger maxLength = kSAPropertyValueMaxLength;
if ([key isEqualToString:@"app_crashed_reason"]) {
maxLength = maxLength * 2;
}
if (self.length >= maxLength) {
SALogWarn(@"%@'s length is longer than %ld", self, maxLength);
NSMutableString *tempString = [NSMutableString stringWithString:[self substringToIndex:maxLength - 1]];
[tempString appendString:@"$"];
return [tempString copy];
}
return self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#import "SARepeatFlushInterceptor.h"
#import "SAFlowManager.h"

static NSInteger const kSAFlushMaxRepeatCount = 100;
static NSInteger const kSAFlushMaxRepeatCount = 40;

@interface SARepeatFlushInterceptor ()
@end
Expand Down
55 changes: 32 additions & 23 deletions SensorsAnalyticsSDK/Core/Network/SACarrierNamePropertyPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import "SAConstants+Private.h"
#import "SALimitKeyManager.h"
#import "SAValidator.h"
#import "SACoreResources.h"

#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
Expand All @@ -40,6 +41,7 @@
@interface SACarrierNamePropertyPlugin()
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
@property (nonatomic, strong) CTTelephonyNetworkInfo *networkInfo;
@property (nonatomic, strong) CTCarrier *carrier;
#endif
@end
@implementation SACarrierNamePropertyPlugin
Expand Down Expand Up @@ -71,24 +73,16 @@ - (NSString *)currentCarrierName {
NSString *carrierName = nil;

@try {
CTCarrier *carrier = nil;

#ifdef __IPHONE_12_0
if (@available(iOS 12.1, *)) {
// 排序
NSArray *carrierKeysArray = [self.networkInfo.serviceSubscriberCellularProviders.allKeys sortedArrayUsingSelector:@selector(compare:)];
carrier = self.networkInfo.serviceSubscriberCellularProviders[carrierKeysArray.firstObject];
if (!carrier.mobileNetworkCode) {
carrier = self.networkInfo.serviceSubscriberCellularProviders[carrierKeysArray.lastObject];
if (self.carrier != nil) {
NSString *networkCode = nil;
if ([self.carrier respondsToSelector:@selector(mobileNetworkCode)]) {
networkCode = [self.carrier mobileNetworkCode];
}

NSString *countryCode = nil;
if ([self.carrier respondsToSelector:@selector(mobileCountryCode)]) {
countryCode = [self.carrier mobileCountryCode];
}
}
#endif
if (!carrier) {
carrier = self.networkInfo.subscriberCellularProvider;
}
if (carrier != nil) {
NSString *networkCode = [carrier mobileNetworkCode];
NSString *countryCode = [carrier mobileCountryCode];

// 中国运营商 mcc 标识
NSString *carrierChinaMCC = @"460";
Expand Down Expand Up @@ -116,12 +110,7 @@ - (NSString *)currentCarrierName {
carrierName = SALocalizedString(@"SAPresetPropertyCarrierTietong");
}
} else if (countryCode && networkCode) { //国外运营商解析
//加载当前 bundle
NSBundle *sensorsBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"SensorsAnalyticsSDK" ofType:@"bundle"]];
//文件路径
NSString *jsonPath = [sensorsBundle pathForResource:@"sa_mcc_mnc_mini.json" ofType:nil];
NSData *jsonData = [NSData dataWithContentsOfFile:jsonPath];
NSDictionary *dicAllMcc = [SAJSONUtil JSONObjectWithData:jsonData];
NSDictionary *dicAllMcc = [SACoreResources mcc];
if (dicAllMcc) {
NSString *mccMncKey = [NSString stringWithFormat:@"%@%@", countryCode, networkCode];
carrierName = dicAllMcc[mccMncKey];
Expand All @@ -133,6 +122,26 @@ - (NSString *)currentCarrierName {
}
return carrierName;
}

- (CTCarrier *)carrier {
if (!_carrier) {
#ifdef __IPHONE_12_0
if (@available(iOS 12.1, *)) {
// 排序
NSArray *carrierKeysArray = [self.networkInfo.serviceSubscriberCellularProviders.allKeys sortedArrayUsingSelector:@selector(compare:)];
_carrier = self.networkInfo.serviceSubscriberCellularProviders[carrierKeysArray.firstObject];
if (![_carrier respondsToSelector:@selector(mobileNetworkCode)] || !_carrier.mobileNetworkCode) {
_carrier = self.networkInfo.serviceSubscriberCellularProviders[carrierKeysArray.lastObject];
}
}
#endif
if (!_carrier && [self.networkInfo respondsToSelector:@selector(subscriberCellularProvider)]) {
_carrier = self.networkInfo.subscriberCellularProvider;
}
}
return _carrier;
}

#endif

#pragma mark - SAPropertyPlugin method
Expand Down
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/Core/SAConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void sensorsdata_dispatch_safe_sync(dispatch_queue_t queue,DISPATCH_NOESCAPE dis

//event name、property key、value max length
NSInteger kSAEventNameMaxLength = 100;
NSInteger kSAPropertyValueMaxLength = 1024;
NSInteger kSAPropertyValueMaxLength = 8192;

#pragma mark - SA Visualized
/// 埋点校验中,$WebClick 匹配可视化全埋点的事件名(集合)
Expand Down
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#import "SALimitKeyManager.h"
#import "NSDictionary+SACopyProperties.h"

#define VERSION @"4.5.6"
#define VERSION @"4.5.7"

void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag;

Expand Down

0 comments on commit 6a6ea5b

Please sign in to comment.