Skip to content

Commit 84dfd18

Browse files
authored
Merge branch 'releases/7.x' into upload_gzip
2 parents 2ef54b5 + 9b4a558 commit 84dfd18

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#Changelog
22

3+
## 7.4.4 (2020-08-13)
4+
## 修正
5+
修复reporter的bug,增加NSHandle的异常捕获。
6+
37
## 7.4.3 (2020-07-27)
48
## 优化
59
优化Dns预取的缓存方案

Qiniu.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 = 'Qiniu'
3-
s.version = '7.4.3'
3+
s.version = '7.4.4'
44
s.summary = 'Qiniu Resource Storage SDK for iOS and Mac'
55
s.homepage = 'https://github.com/qiniu/objc-sdk'
66
s.social_media_url = 'http://weibo.com/qiniutek'

QiniuSDK/Storage/QNUploadInfoReporter.m

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,7 @@ - (void)clean {
434434
NSError *error = nil;
435435
[_fileManager removeItemAtPath:_recorderFilePath error:&error];
436436
if (error) {
437-
QNAsyncRunInMain(^{
438-
NSLog(@"remove recorder file failed: %@", error);
439-
});
437+
NSLog(@"remove recorder file failed: %@", error);
440438
return;
441439
}
442440
}
@@ -446,9 +444,7 @@ - (BOOL)checkReportAvailable {
446444

447445
if (!_config.isReportEnable) return NO;
448446
if (!(_config.maxRecordFileSize > _config.uploadThreshold)) {
449-
QNAsyncRunInMain(^{
450-
NSLog(@"maxRecordFileSize must be larger than uploadThreshold");
451-
});
447+
NSLog(@"maxRecordFileSize must be larger than uploadThreshold");
452448
return NO;
453449
}
454450
return YES;
@@ -471,9 +467,7 @@ - (void)innerReport:(NSString *)jsonString token:(NSString *)token {
471467
if (![_fileManager fileExistsAtPath:_config.recordDirectory]) {
472468
[_fileManager createDirectoryAtPath:_config.recordDirectory withIntermediateDirectories:YES attributes:nil error:&error];
473469
if (error) {
474-
QNAsyncRunInMain(^{
475-
NSLog(@"create record directory failed, please check record directory: %@", error.localizedDescription);
476-
});
470+
NSLog(@"create record directory failed, please check record directory: %@", error.localizedDescription);
477471
return;
478472
}
479473
}
@@ -487,19 +481,21 @@ - (void)innerReport:(NSString *)jsonString token:(NSString *)token {
487481
// recordFile存在,拼接文件内容、上传到服务器
488482
QNFile *file = [[QNFile alloc] init:_recorderFilePath error:&error];
489483
if (error) {
490-
QNAsyncRunInMain(^{
491-
NSLog(@"create QNFile with path failed: %@", error.localizedDescription);
492-
});
484+
NSLog(@"create QNFile with path failed: %@", error.localizedDescription);
493485
return;
494486
}
495487

496488
// 判断recorder文件大小是否超过maxRecordFileSize
497489
if (file.size < _config.maxRecordFileSize) {
498-
// 上传信息写入recorder文件
499-
NSFileHandle *fileHandler = [NSFileHandle fileHandleForUpdatingAtPath:_recorderFilePath];
500-
[fileHandler seekToEndOfFile];
501-
[fileHandler writeData:[finalRecordInfo dataUsingEncoding:NSUTF8StringEncoding]];
502-
[fileHandler closeFile];
490+
@try {
491+
// 上传信息写入recorder文件
492+
NSFileHandle *fileHandler = [NSFileHandle fileHandleForUpdatingAtPath:_recorderFilePath];
493+
[fileHandler seekToEndOfFile];
494+
[fileHandler writeData: [finalRecordInfo dataUsingEncoding:NSUTF8StringEncoding]];
495+
[fileHandler closeFile];
496+
} @catch (NSException *exception) {
497+
NSLog(@"NSFileHandle cannot write data: %@", exception.description);
498+
}
503499
}
504500

505501
// 判断是否满足上传条件:文件大于上报临界值 && (首次上传 || 距上次上传时间大于_config.interval)
@@ -530,9 +526,7 @@ - (void)innerReport:(NSString *)jsonString token:(NSString *)token {
530526
}
531527
[self clean];
532528
} else {
533-
QNAsyncRunInMain(^{
534-
NSLog(@"upload info report failed: %@", error.localizedDescription);
535-
});
529+
NSLog(@"upload info report failed: %@", error.localizedDescription);
536530
}
537531
[session finishTasksAndInvalidate];
538532
dispatch_semaphore_signal(self.semaphore);

QiniuSDK/Utils/QNVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
/**
1212
* sdk 版本
1313
*/
14-
static NSString *const kQiniuVersion = @"7.4.3";
14+
static NSString *const kQiniuVersion = @"7.4.4";

0 commit comments

Comments
 (0)