Skip to content

Commit 4ff4736

Browse files
author
garenwang
committed
fix 修改自定义loader加载逻辑
1 parent 727c7b2 commit 4ff4736

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

QCloudCore/Classes/Base/CustomLoader/QCloudLoaderManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
1515

1616
@property (nonatomic,assign)BOOL enable;
1717

18-
@property (nonatomic,strong,readonly)NSMutableArray <id <QCloudCustomLoader>> * loaders;
18+
@property (atomic,strong,readonly)NSMutableArray <id <QCloudCustomLoader>> * loaders;
1919

2020
- (void)addLoader:(id <QCloudCustomLoader>)loader;
2121

QCloudCore/Classes/Base/CustomLoader/QCloudLoaderManager.m

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
#import "QCloudLoaderManager.h"
99
#import "QCloudHTTPRequest.h"
10-
10+
#import "QCloudHTTPSessionManager.h"
1111
@interface QCloudLoaderManager()
12-
@property (nonatomic,strong)NSMutableArray <id <QCloudCustomLoader>> * loaders;
12+
@property (atomic,strong)NSMutableArray <id <QCloudCustomLoader>> * loaders;
1313
@end
1414

1515
@implementation QCloudLoaderManager
@@ -43,7 +43,10 @@ - (instancetype)init
4343
}
4444

4545
-(void)addLoader:(id <QCloudCustomLoader>)loader{
46-
[self.loaders addObject:loader];
46+
@synchronized (self) {
47+
loader.session.customDelegate = [QCloudHTTPSessionManager shareClient];
48+
[self.loaders addObject:loader];
49+
}
4750
}
4851

4952
@end

QCloudCore/Classes/Base/QCLOUDRestNet/SessionSupport/QCloudHTTPSessionManager.m

-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ - (instancetype)initWithConfigruation:(NSURLSessionConfiguration *)configuration
105105
QCloudLogDebug(@"quicSession is nil");
106106
}
107107

108-
[[[QCloudLoaderManager manager] loaders] enumerateObjectsUsingBlock:^(id <QCloudCustomLoader> _Nonnull loader, NSUInteger idx, BOOL * _Nonnull stop) {
109-
loader.session.customDelegate = self;
110-
}];
111-
112108
_buildDataQueue = dispatch_queue_create("com.tencent.qcloud.build.data", NULL);
113109
_taskQueue = [NSMutableDictionary new];
114110
_operationQueue = [QCloudOperationQueue new];

0 commit comments

Comments
 (0)