Commit 1390f35c15a020397eb58d479123e684698fe827

Authored by yanglingyu
1 parent 7839ad72

增加属性

CNLiveUploadManager.podspec
... ... @@ -8,7 +8,7 @@
8 8  
9 9 Pod::Spec.new do |s|
10 10 s.name = 'CNLiveUploadManager'
11   - s.version = '0.1.25'
  11 + s.version = '0.1.26'
12 12 s.summary = '压缩上传,组件化中加入新参数加入outPath,不在直接取'
13 13  
14 14 # This description is used to generate tags and improve search results.
... ...
CNLiveUploadManager/Classes/CNLiveUploadManager.h
... ... @@ -75,6 +75,7 @@ typedef void (^progressHandlerBlock)(float progress);//进度
75 75 @interface CNLiveUploadManager : NSObject
76 76  
77 77 @property (nonatomic, strong)QNUploadOption *qnUploadOption;
  78 +@property (nonatomic, assign)BOOL calcelOption;
78 79 /**
79 80 释放单例
80 81 */
... ...
CNLiveUploadManager/Classes/CNLiveUploadManager.m
... ... @@ -243,12 +243,12 @@ static CNLiveUploadManager *_uploadManager;
243 243 @"x:total":total,
244 244 @"x:current":current
245 245 }.copy;
246   -
  246 + __weak typeof(self)weakSelf = self;
247 247 QNUploadOption *opt = [[QNUploadOption alloc] initWithMime:nil progressHandler:^(NSString *key, float percent) {
248 248  
249 249 !progress ? : progress(percent);
250 250 } params:dic checkCrc:YES cancellationSignal:^BOOL{
251   - return YES;
  251 + return weakSelf.calcelOption;
252 252 }];
253 253 self.qnUploadOption = opt;
254 254 [_qnUploadManager putData:data key:key token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
... ... @@ -305,12 +305,13 @@ static CNLiveUploadManager *_uploadManager;
305 305 @"x:current":current
306 306 }.copy;
307 307 __block CGFloat currentPresent =0;//当前进度
  308 + __weak typeof(self)weakSelf = self;
308 309 QNUploadOption *opt = [[QNUploadOption alloc] initWithMime:nil progressHandler:^(NSString *key, float percent) {
309 310 currentPresent += percent;
310 311 NSLog(@"输出个数%f",currentPresent);//单个视频的进度
311 312 !progress ? : progress(currentPresent);
312 313 } params:dic checkCrc:YES cancellationSignal:^BOOL{
313   - return YES;
  314 + return weakSelf.calcelOption;
314 315 }];
315 316 self.qnUploadOption = opt;
316 317 [_qnUploadManager putPHAsset:phAsset key:key token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
... ... @@ -359,13 +360,13 @@ static CNLiveUploadManager *_uploadManager;
359 360 @"x:total":total,
360 361 @"x:current":current
361 362 }.copy;
362   -
  363 + __weak typeof(self)weakSelf = self;
363 364 QNUploadOption *opt = [[QNUploadOption alloc] initWithMime:nil progressHandler:^(NSString *key, float percent) {
364 365  
365 366 NSLog(@"输出个数%f",percent);//单个视频的进度
366 367 !progress ? : progress(percent);
367 368 } params:dic checkCrc:YES cancellationSignal:^BOOL{
368   - return YES;
  369 + return weakSelf.calcelOption;
369 370 }];
370 371 self.qnUploadOption = opt;
371 372 [_qnUploadManager putFile:file key:key token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
... ... @@ -426,7 +427,9 @@ static CNLiveUploadManager *_uploadManager;
426 427 //创建group
427 428 dispatch_group_t group = dispatch_group_create();
428 429 //GCD遍历图片数组
  430 +
429 431 __weak __typeof(_qnUploadManager)weakManager = _qnUploadManager;
  432 + __weak typeof(self)weakSelf = self;
430 433 dispatch_apply(dataArr.count, globalQueue, ^(size_t index) {
431 434 dispatch_group_enter(group);
432 435 __strong __typeof(weakManager)strongManager = weakManager;
... ... @@ -441,9 +444,9 @@ static CNLiveUploadManager *_uploadManager;
441 444 QNUploadOption *opt = [[QNUploadOption alloc] initWithMime:nil progressHandler:^(NSString *key, float percent) {
442 445  
443 446 } params:dic checkCrc:YES cancellationSignal:^BOOL{
444   - return YES;
  447 + return weakSelf.calcelOption;
445 448 }];
446   - self.qnUploadOption = opt;
  449 + weakSelf.qnUploadOption = opt;
447 450 [strongManager putData:dataArr[index] key:keys[index] token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
448 451  
449 452 NSLog(@"***输出第%zi图片***",index);
... ...