Open DevTonyXu opened 7 years ago
// 更新下载进度
//解析resumeData数据获取已下载大小
(long long)fileSizeWithResumeData:(NSData *)resumeData {
NSString resumeStr = [[NSString alloc]initWithData:resumeData encoding:NSUTF8StringEncoding]; if ([resumeStr isEqualToString:@""]) { return 0; } NSRange oneStringRange = [resumeStr rangeOfString:@"NSURLSessionResumeBytesReceived"]; NSRange twoStringRange = [resumeStr rangeOfString:@"NSURLSessionResumeCurrentRequest"]; NSString tmpString = [resumeStr substringWithRange:NSMakeRange(oneStringRange.location+oneStringRange.length, twoStringRange.location-oneStringRange.location-oneStringRange.length)];
NSRange preRange = [tmpString rangeOfString:@"
}
获取到下载过程中的resumeData,然后用这个方法解析即可
博主能不能对TYDownloadSessionManager添加下载进度的获取方法啊