集成CC视频sdk时关于离线下载在iOS 12闪退的问题

在iOS 12中苹果不允许对下载的resumeData进行修改编译,目前已经进行了修改,如果遇到这个问题可以自行修改也可以下载最新的demo或者联系研发人员!

#define IOS12 [[UIDevice currentDevice].systemVersion floatValue]>=12?YES:NO
 [vc.downloadTask cancelByProducingResumeData:^(NSData * _Nullable resumeData) {
            NSMutableDictionary *plist = [[FileManager sharedInstance]plist];
            NSMutableDictionary *dicItem = [plist objectForKey:vc.downLoadUrl];
        if (IOS12) {
            if (resumeData && dicItem) {
            [dicItem setObject:resumeData forKey:@"dataString"];
            [plist setObject:dicItem forKey:vc.downLoadUrl];
            [[FileManager sharedInstance]saveplist:plist];
            
            if(vc.downloadType == DOWNLOAD_LOADING) {
               
                vc.downloadTask = [vc.session downloadTaskWithResumeData:resumeData];
                // 继续下载
                [vc.downloadTask resume];
            }
            }
        }else {
        
         if (resumeData && dicItem) {
         NSString *dataString = [[NSString alloc] initWithData:resumeData encoding:NSUTF8StringEncoding];
         dataString = [self cleanResumeData:dataString];
         NSString *tempName = [dataString componentsSeparatedByString:@"NSURLSessionResumeInfoTempFileName\n\t"].lastObject;
         tempName = [tempName componentsSeparatedByString:@""].firstObject;
         
         [dicItem setObject:tempName forKey:@"tempName"];
         [dicItem setObject:dataString forKey:@"dataString"];
         [plist setObject:dicItem forKey:vc.downLoadUrl];
         [[FileManager sharedInstance]saveplist:plist];
         vc.tempName = tempName;
         //                NSLog(@"---filename = %@,downloadsize = %lld,tempName = %@",self.fileName,_alreadyDownLoadSize,tempName);
         vc.downloadTask = nil;
         // 保存完信息之后开始继续下载。
         if(vc.downloadType == DOWNLOAD_LOADING) {
         vc.downloadTask = [vc.session downloadTaskWithResumeData:[dataString dataUsingEncoding:NSUTF8StringEncoding]];
         //                    vc.downloadTask = [vc.session downloadTaskWithResumeData:resumeData];
         // 继续下载
         [vc.downloadTask resume];
         }
         }
        }
    }];

你可能感兴趣的:(集成CC视频sdk时关于离线下载在iOS 12闪退的问题)