diff --git a/SensorsAnalyticsSDK.podspec b/SensorsAnalyticsSDK.podspec index 6f5d4696..130e5dcf 100644 --- a/SensorsAnalyticsSDK.podspec +++ b/SensorsAnalyticsSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SensorsAnalyticsSDK" - s.version = "4.7.1" + s.version = "4.7.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/Core/HookDelegate/NSObject+SADelegateProxy.m b/SensorsAnalyticsSDK/Core/HookDelegate/NSObject+SADelegateProxy.m index 784b2eb3..1663c5cb 100644 --- a/SensorsAnalyticsSDK/Core/HookDelegate/NSObject+SADelegateProxy.m +++ b/SensorsAnalyticsSDK/Core/HookDelegate/NSObject+SADelegateProxy.m @@ -59,7 +59,7 @@ - (BOOL)sensorsdata_respondsToSelector:(SEL)aSelector { } #if TARGET_OS_IOS - if ([[UIDevice currentDevice].systemVersion floatValue] == 18.0) { + if (@available(iOS 18.0, *)) { char cString = (char)sel_getName(aSelector); if (cString == '\x01') { return NO; diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m index 6c123117..8387a6db 100755 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m @@ -68,7 +68,7 @@ #import #endif -#define VERSION @"4.7.1" +#define VERSION @"4.7.2" void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag; diff --git a/SensorsAnalyticsSDK/Store/SAAESCrypt.m b/SensorsAnalyticsSDK/Store/SAAESCrypt.m index 987a791c..d3d1768c 100644 --- a/SensorsAnalyticsSDK/Store/SAAESCrypt.m +++ b/SensorsAnalyticsSDK/Store/SAAESCrypt.m @@ -63,6 +63,7 @@ - (nullable NSString *)encryptData:(NSData *)obj { NSMutableData *iv = [NSMutableData dataWithLength:kCCBlockSizeAES128]; int result = SecRandomCopyBytes(kSecRandomDefault, kCCBlockSizeAES128, iv.mutableBytes); if (result != errSecSuccess) { + free(buffer); return nil; } @@ -111,6 +112,7 @@ - (nullable NSData *)decryptData:(NSData *)obj { NSMutableData *iv = [NSMutableData dataWithLength:kCCBlockSizeAES128]; int result = SecRandomCopyBytes(kSecRandomDefault, kCCBlockSizeAES128, iv.mutableBytes); if (result != errSecSuccess) { + free(buffer); return nil; } diff --git a/SensorsAnalyticsTests/SAEncryptTests.m b/SensorsAnalyticsTests/SAEncryptTests.m index 91bf7740..3f22e890 100644 --- a/SensorsAnalyticsTests/SAEncryptTests.m +++ b/SensorsAnalyticsTests/SAEncryptTests.m @@ -90,6 +90,7 @@ - (NSString *)aesDecrypt:(NSData *)publicKey encryptedContent:(NSString *)encryp NSData *result = [NSData dataWithBytesNoCopy:buffer length:numBytesDecrypted]; NSRange range = NSMakeRange(16, result.length - 16); NSData *da = [result subdataWithRange:range]; + return [[NSString alloc] initWithData:da encoding:NSUTF8StringEncoding]; } free(buffer);