12207480 / TYDownloadManager

Download file manager wrapped NSURLSessionDataTask and NSURLSessionDownloadTask,provide progress update and status change.
409 stars 79 forks source link

NSURLSession+TYCorrectedResumeData 崩溃 #56

Open SmallWeed opened 6 years ago

SmallWeed commented 6 years ago

2018-05-30 11 34 12 2018-05-30 11 34 23

我在原来修改过的 旧版本上,替换了最新的NSURLSession+TYCorrectedResumeData 但是在downloadTaskWithResumeData 还是出现了崩溃

SmallWeed commented 6 years ago

close , 问题已解决

需要同时兼容iOS 10,iOS 11

if (IS_IOS11ORLATER)
{
    NSString *dataStr = [[NSString alloc]initWithData:resumeData encoding:NSUTF8StringEncoding];
    NSString *newStr = [self cleanResumeDataWithString:dataStr];
    resumeData = [newStr dataUsingEncoding:NSUTF8StringEncoding];
}

else if (IS_IOS10ORLATER) {

    NSData *cData = correctResumeData(resumeData);
    resumeData = cData?cData:resumeData;
}

NSURLSessionDownloadTask *task = [self downloadTaskWithResumeData:resumeData];
NSMutableDictionary *resumeDic = getResumeDictionary(resumeData);