Skip to content

Commit b4b4072

Browse files
committed
Release 1.6.22
1 parent 683f7e5 commit b4b4072

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

SensorsAnalyticsSDK/SensorsAnalyticsSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "SensorsAnalyticsSDK"
3-
s.version = "1.6.21"
3+
s.version = "1.6.22"
44
s.summary = "The offical iOS SDK of Sensors Analytics."
55
s.homepage = "http://www.sensorsdata.cn"
66
s.source = { :git => 'https://github.com/sensorsdata/sa-sdk-ios.git', :tag => "v#{s.version}" }

SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.m

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#import <WebKit/WebKit.h>
3636
#endif
3737

38-
#define VERSION @"1.6.21"
38+
#define VERSION @"1.6.22"
3939

4040
#define PROPERTY_LENGTH_LIMITATION 8191
4141

@@ -387,19 +387,28 @@ - (void)flushByType:(NSString *)type withSize:(int)flushSize andFlushMethod:(BOO
387387
- (void)_flush:(BOOL) vacuumAfterFlushing {
388388
// 使用 Post 发送数据
389389
BOOL (^flushByPost)(NSArray *, NSString *) = ^(NSArray *recordArray, NSString *type) {
390-
// 1. 先完成这一系列Json字符串的拼接
391-
NSString *jsonString = [NSString stringWithFormat:@"[%@]",[recordArray componentsJoinedByString:@","]];
392-
// 2. 使用gzip进行压缩
393-
NSData *zippedData = [LFCGzipUtility gzipData:[jsonString dataUsingEncoding:NSUTF8StringEncoding]];
394-
// 3. base64
395-
NSString *b64String = [zippedData sa_base64EncodedString];
396-
b64String = (id)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
397-
(CFStringRef)b64String,
398-
NULL,
399-
CFSTR("!*'();:@&=+$,/?%#[]"),
400-
kCFStringEncodingUTF8));
401-
402-
NSString *postBody = [NSString stringWithFormat:@"gzip=1&data_list=%@", b64String];
390+
NSString *jsonString;
391+
NSData *zippedData;
392+
NSString *b64String;
393+
NSString *postBody;
394+
@try {
395+
// 1. 先完成这一系列Json字符串的拼接
396+
jsonString = [NSString stringWithFormat:@"[%@]",[recordArray componentsJoinedByString:@","]];
397+
// 2. 使用gzip进行压缩
398+
zippedData = [LFCGzipUtility gzipData:[jsonString dataUsingEncoding:NSUTF8StringEncoding]];
399+
// 3. base64
400+
b64String = [zippedData sa_base64EncodedString];
401+
b64String = (id)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
402+
(CFStringRef)b64String,
403+
NULL,
404+
CFSTR("!*'();:@&=+$,/?%#[]"),
405+
kCFStringEncodingUTF8));
406+
407+
postBody = [NSString stringWithFormat:@"gzip=1&data_list=%@", b64String];
408+
} @catch (NSException *exception) {
409+
SAError(@"%@ flushByPost format data error: %@", self, exception);
410+
return YES;
411+
}
403412

404413
NSURL *URL = [NSURL URLWithString:self.serverURL];
405414
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];

0 commit comments

Comments
 (0)