Skip to content

Commit

Permalink
JCDownloader
Browse files Browse the repository at this point in the history
  • Loading branch information
imjoych committed Jun 9, 2016
1 parent a78efae commit f6d7b4c
Show file tree
Hide file tree
Showing 16 changed files with 106 additions and 63 deletions.
6 changes: 5 additions & 1 deletion JCNetworking.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'JCNetworking'
s.version = '0.0.1'
s.version = '0.0.2'
s.license = 'MIT'
s.summary = 'A useful iOS networking framework based on AFNetworking and JSONModel.'
s.homepage = 'https://github.com/boych/JCNetworking'
Expand All @@ -10,6 +10,10 @@ Pod::Spec.new do |s|
s.platform = :ios, '7.0'
s.requires_arc = true

s.subspec "JCDownloader" do |ss|
ss.source_files = "JCNetworking/JCDownloader/*.{h,m}"
end

s.dependency 'AFNetworking', '~> 3.1.0'
s.dependency 'JSONModel', '~> 1.2.0'

Expand Down
62 changes: 36 additions & 26 deletions JCNetworking.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

/* Begin PBXBuildFile section */
05A926779BF40BBF06BBF14A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 580BE4179B4567E57A50E8F8 /* libPods.a */; };
0F6FEF3D1CF2DCD80023D04E /* JCDownloadQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F6FEF3C1CF2DCD80023D04E /* JCDownloadQueue.m */; };
0F6FEF411CF306890023D04E /* JCDownloadUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F6FEF401CF306890023D04E /* JCDownloadUtilities.m */; };
0FC2D0F11D0659C600C6FAA2 /* JCNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FC2D0F01D0659C600C6FAA2 /* JCNetworkReachabilityManager.m */; };
0FF08B8C1CD9D67900B6C820 /* JCBaseRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FF08B8B1CD9D67900B6C820 /* JCBaseRequest.m */; };
0FF08B951CD9ED4200B6C820 /* JCNetworkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FF08B941CD9ED4200B6C820 /* JCNetworkManager.m */; };
Expand All @@ -20,19 +18,16 @@
230C432A1C8C0315002D6D52 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 230C43291C8C0315002D6D52 /* Assets.xcassets */; };
230C432D1C8C0315002D6D52 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 230C432B1C8C0315002D6D52 /* LaunchScreen.storyboard */; };
232DD32D1D05B9E300D820BF /* JCWeixinSSOManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 232DD32C1D05B9E300D820BF /* JCWeixinSSOManager.m */; };
236334B31D090712001932B9 /* JCDownloadAgent.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334AB1D090712001932B9 /* JCDownloadAgent.m */; };
236334B41D090712001932B9 /* JCDownloadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334AD1D090712001932B9 /* JCDownloadOperation.m */; };
236334B51D090712001932B9 /* JCDownloadQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334B01D090712001932B9 /* JCDownloadQueue.m */; };
236334B61D090712001932B9 /* JCDownloadUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334B21D090712001932B9 /* JCDownloadUtilities.m */; };
2394E7441D025E02002A200F /* JCLargeFileDownloadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2394E73E1D025E02002A200F /* JCLargeFileDownloadViewController.m */; };
2394E7451D025E02002A200F /* JCTImageDownloadCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2394E7401D025E02002A200F /* JCTImageDownloadCell.m */; };
2394E7461D025E02002A200F /* JCTImageDownloadItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 2394E7421D025E02002A200F /* JCTImageDownloadItem.m */; };
23FC0C7E1CEFF014005C9949 /* JCDownloadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FC0C7D1CEFF014005C9949 /* JCDownloadOperation.m */; };
23FC0C811CEFF11F005C9949 /* JCDownloadAgent.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FC0C801CEFF11F005C9949 /* JCDownloadAgent.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
0F6FEF3B1CF2DCD80023D04E /* JCDownloadQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadQueue.h; sourceTree = "<group>"; };
0F6FEF3C1CF2DCD80023D04E /* JCDownloadQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadQueue.m; sourceTree = "<group>"; };
0F6FEF3E1CF2F4780023D04E /* JCDownloadOperationProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadOperationProtocol.h; sourceTree = "<group>"; };
0F6FEF3F1CF306890023D04E /* JCDownloadUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadUtilities.h; sourceTree = "<group>"; };
0F6FEF401CF306890023D04E /* JCDownloadUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadUtilities.m; sourceTree = "<group>"; };
0FBFB0321C1BCC0400B5A45D /* JCNetworking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JCNetworking.h; sourceTree = "<group>"; };
0FC2D0EF1D0659C600C6FAA2 /* JCNetworkReachabilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCNetworkReachabilityManager.h; sourceTree = "<group>"; };
0FC2D0F01D0659C600C6FAA2 /* JCNetworkReachabilityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCNetworkReachabilityManager.m; sourceTree = "<group>"; };
Expand All @@ -52,17 +47,23 @@
230C432E1C8C0315002D6D52 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
232DD32B1D05B9E300D820BF /* JCWeixinSSOManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCWeixinSSOManager.h; sourceTree = "<group>"; };
232DD32C1D05B9E300D820BF /* JCWeixinSSOManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCWeixinSSOManager.m; sourceTree = "<group>"; };
236334AA1D090712001932B9 /* JCDownloadAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadAgent.h; sourceTree = "<group>"; };
236334AB1D090712001932B9 /* JCDownloadAgent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadAgent.m; sourceTree = "<group>"; };
236334AC1D090712001932B9 /* JCDownloadOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadOperation.h; sourceTree = "<group>"; };
236334AD1D090712001932B9 /* JCDownloadOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadOperation.m; sourceTree = "<group>"; };
236334AE1D090712001932B9 /* JCDownloadOperationProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadOperationProtocol.h; sourceTree = "<group>"; };
236334AF1D090712001932B9 /* JCDownloadQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadQueue.h; sourceTree = "<group>"; };
236334B01D090712001932B9 /* JCDownloadQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadQueue.m; sourceTree = "<group>"; };
236334B11D090712001932B9 /* JCDownloadUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadUtilities.h; sourceTree = "<group>"; };
236334B21D090712001932B9 /* JCDownloadUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadUtilities.m; sourceTree = "<group>"; };
236334B71D09075B001932B9 /* JCDownloader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JCDownloader.h; sourceTree = "<group>"; };
2394E73D1D025E02002A200F /* JCLargeFileDownloadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCLargeFileDownloadViewController.h; sourceTree = "<group>"; };
2394E73E1D025E02002A200F /* JCLargeFileDownloadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCLargeFileDownloadViewController.m; sourceTree = "<group>"; };
2394E73F1D025E02002A200F /* JCTImageDownloadCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCTImageDownloadCell.h; sourceTree = "<group>"; };
2394E7401D025E02002A200F /* JCTImageDownloadCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCTImageDownloadCell.m; sourceTree = "<group>"; };
2394E7411D025E02002A200F /* JCTImageDownloadItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCTImageDownloadItem.h; sourceTree = "<group>"; };
2394E7421D025E02002A200F /* JCTImageDownloadItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCTImageDownloadItem.m; sourceTree = "<group>"; };
23E991CC1CF1581C009C8917 /* JCNetworkingDemo-prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JCNetworkingDemo-prefix.pch"; sourceTree = "<group>"; };
23FC0C7C1CEFF014005C9949 /* JCDownloadOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadOperation.h; sourceTree = "<group>"; };
23FC0C7D1CEFF014005C9949 /* JCDownloadOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadOperation.m; sourceTree = "<group>"; };
23FC0C7F1CEFF11F005C9949 /* JCDownloadAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadAgent.h; sourceTree = "<group>"; };
23FC0C801CEFF11F005C9949 /* JCDownloadAgent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadAgent.m; sourceTree = "<group>"; };
355581728A723726D3274AA6 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
580BE4179B4567E57A50E8F8 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
C3A222EB81FBEBD593981CC6 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -109,15 +110,7 @@
0FF08B941CD9ED4200B6C820 /* JCNetworkManager.m */,
0FC2D0EF1D0659C600C6FAA2 /* JCNetworkReachabilityManager.h */,
0FC2D0F01D0659C600C6FAA2 /* JCNetworkReachabilityManager.m */,
23FC0C7C1CEFF014005C9949 /* JCDownloadOperation.h */,
23FC0C7D1CEFF014005C9949 /* JCDownloadOperation.m */,
0F6FEF3E1CF2F4780023D04E /* JCDownloadOperationProtocol.h */,
0F6FEF3B1CF2DCD80023D04E /* JCDownloadQueue.h */,
0F6FEF3C1CF2DCD80023D04E /* JCDownloadQueue.m */,
23FC0C7F1CEFF11F005C9949 /* JCDownloadAgent.h */,
23FC0C801CEFF11F005C9949 /* JCDownloadAgent.m */,
0F6FEF3F1CF306890023D04E /* JCDownloadUtilities.h */,
0F6FEF401CF306890023D04E /* JCDownloadUtilities.m */,
236334A91D090712001932B9 /* JCDownloader */,
);
path = JCNetworking;
sourceTree = "<group>";
Expand Down Expand Up @@ -156,6 +149,23 @@
name = "Supporting Files";
sourceTree = "<group>";
};
236334A91D090712001932B9 /* JCDownloader */ = {
isa = PBXGroup;
children = (
236334B71D09075B001932B9 /* JCDownloader.h */,
236334AA1D090712001932B9 /* JCDownloadAgent.h */,
236334AB1D090712001932B9 /* JCDownloadAgent.m */,
236334AC1D090712001932B9 /* JCDownloadOperation.h */,
236334AD1D090712001932B9 /* JCDownloadOperation.m */,
236334AE1D090712001932B9 /* JCDownloadOperationProtocol.h */,
236334AF1D090712001932B9 /* JCDownloadQueue.h */,
236334B01D090712001932B9 /* JCDownloadQueue.m */,
236334B11D090712001932B9 /* JCDownloadUtilities.h */,
236334B21D090712001932B9 /* JCDownloadUtilities.m */,
);
path = JCDownloader;
sourceTree = "<group>";
};
2394E73A1D025E02002A200F /* Classes */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -302,20 +312,20 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
23FC0C7E1CEFF014005C9949 /* JCDownloadOperation.m in Sources */,
230C43251C8C0315002D6D52 /* ViewController.m in Sources */,
230C43221C8C0315002D6D52 /* AppDelegate.m in Sources */,
2394E7451D025E02002A200F /* JCTImageDownloadCell.m in Sources */,
0FC2D0F11D0659C600C6FAA2 /* JCNetworkReachabilityManager.m in Sources */,
232DD32D1D05B9E300D820BF /* JCWeixinSSOManager.m in Sources */,
0FF08B951CD9ED4200B6C820 /* JCNetworkManager.m in Sources */,
0F6FEF3D1CF2DCD80023D04E /* JCDownloadQueue.m in Sources */,
2394E7461D025E02002A200F /* JCTImageDownloadItem.m in Sources */,
2394E7441D025E02002A200F /* JCLargeFileDownloadViewController.m in Sources */,
230C431F1C8C0315002D6D52 /* main.m in Sources */,
23FC0C811CEFF11F005C9949 /* JCDownloadAgent.m in Sources */,
0F6FEF411CF306890023D04E /* JCDownloadUtilities.m in Sources */,
236334B31D090712001932B9 /* JCDownloadAgent.m in Sources */,
236334B41D090712001932B9 /* JCDownloadOperation.m in Sources */,
236334B51D090712001932B9 /* JCDownloadQueue.m in Sources */,
0FF08B8C1CD9D67900B6C820 /* JCBaseRequest.m in Sources */,
236334B61D090712001932B9 /* JCDownloadUtilities.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ typedef NS_ENUM(NSInteger, JCDownloadStatus) {
/** 下载相关数据 */
@interface JCDownloadItem : NSObject

@property (nonatomic, strong) NSString *downloadUrl; //下载链接地址
@property (nonatomic, strong) NSString *downloadFilePath; //下载文件本地路径
@property (nonatomic, strong) NSString *downloadUrl; //下载链接地址,不能为空
@property (nonatomic, strong) NSString *downloadFilePath; //下载文件本地路径,不能为空
@property (nonatomic, strong) NSString *downloadId; //下载唯一标识,为空时自动生成
@property (nonatomic, strong) NSString *groupId; //下载分组标识,可选
@property (nonatomic, strong) NSString *groupId; //下载分组标识
@property (nonatomic, assign) JCDownloadStatus status; //下载状态
@property (nonatomic, assign) int64_t totalUnitCount; //下载文件总大小
@property (nonatomic, assign) int64_t completedUnitCount; //已下载文件大小
Expand All @@ -45,11 +45,13 @@ typedef void(^JCDownloadCompletionBlock)(NSURL *filePath, NSError *error);
/** 文件下载类 */
@interface JCDownloadOperation : NSObject

@property (nonatomic, strong) JCDownloadItem *item;

@property (nonatomic, strong, readonly) JCDownloadItem *item;
@property (nonatomic, copy, readonly) JCDownloadProgressBlock progressBlock;
@property (nonatomic, copy, readonly) JCDownloadCompletionBlock completionBlock;

/** 实例化对象 */
+ (instancetype)operationWithItem:(JCDownloadItem *)item;

/** 开始下载 */
- (void)startDownload;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ - (NSString *)downloadId

@interface JCDownloadOperation ()

@property (nonatomic, strong) JCDownloadItem *item;
@property (nonatomic, copy) JCDownloadProgressBlock progressBlock;
@property (nonatomic, copy) JCDownloadCompletionBlock completionBlock;

Expand All @@ -43,6 +44,24 @@ - (void)dealloc
[self clearBlocks];
}

- (instancetype)initWithItem:(JCDownloadItem *)item
{
if (self = [super init]) {
_item = item;
}
return self;
}

+ (instancetype)operationWithItem:(JCDownloadItem *)item
{
JCDownloadOperation *operation = [[JCDownloadQueue sharedQueue] downloadOperation:item.downloadId
groupId:item.groupId];
if (operation) {
return operation;
}
return [[self alloc] initWithItem:item];
}

- (void)startDownload
{
[[JCDownloadQueue sharedQueue] startDownload:self];
Expand All @@ -51,7 +70,8 @@ - (void)startDownload
- (void)startWithProgressBlock:(JCDownloadProgressBlock)progressBlock
completionBlock:(JCDownloadCompletionBlock)completionBlock
{
[self resetProgressBlock:progressBlock completionBlock:completionBlock];
[self resetProgressBlock:progressBlock
completionBlock:completionBlock];
[self startDownload];
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions JCNetworking/JCDownloader/JCDownloader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// JCDownloader.h
// JCNetworking
//
// Created by ChenJianjun on 16/6/9.
// Copyright © 2016年 JC. All rights reserved.
//

#ifndef JCDownloader_h
#define JCDownloader_h

#import "JCDownloadOperation.h"
#import "JCDownloadOperationProtocol.h"
#import "JCDownloadQueue.h"
#import "JCDownloadAgent.h"
#import "JCDownloadUtilities.h"

#endif /* JCDownloader_h */
11 changes: 6 additions & 5 deletions JCNetworking/JCNetworking.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

#import <Foundation/Foundation.h>

#ifndef JCNetworking_h
#define JCNetworking_h

#import "JCBaseRequest.h"
#import "JCNetworkManager.h"
#import "JCNetworkReachabilityManager.h"

#import "JCDownloadOperation.h"
#import "JCDownloadOperationProtocol.h"
#import "JCDownloadQueue.h"
#import "JCDownloadAgent.h"
#import "JCDownloadUtilities.h"
#import "JCDownloader.h"

#endif /* JCNetworking_h */
28 changes: 11 additions & 17 deletions JCNetworkingDemo/Classes/JCLargeFileDownloadViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,17 @@ - (void)initDownloadData
downloadItem.groupId = @"largeFileDownloadGroupId";
downloadItem.downloadUrl = @"http://dldir1.qq.com/qqfile/QQforMac/QQ_V4.0.6.dmg";
downloadItem.downloadFilePath = [JCDownloadUtilities filePathWithFileName:[downloadItem.downloadUrl lastPathComponent] folderName:@"downloadFiles"];
JCDownloadOperation *operation = [[JCDownloadQueue sharedQueue] downloadOperation:downloadItem.downloadId groupId:downloadItem.groupId];
if (operation) {
self.downloadOperation = operation;
@weakify(self);
[self.downloadOperation resetProgressBlock:^(NSProgress *progress) {
@strongify(self);
[self resetProgressWithCompletedUnitCount:progress.completedUnitCount
totalUnitCount:progress.totalUnitCount];
} completionBlock:^(NSURL *filePath, NSError *error) {
@strongify(self);
[self resetProgressWithCompletedUnitCount:self.downloadOperation.item.completedUnitCount
totalUnitCount:self.downloadOperation.item.totalUnitCount];
}];
} else {
self.downloadOperation = [[JCDownloadOperation alloc] init];
self.downloadOperation.item = downloadItem;
}
self.downloadOperation = [JCDownloadOperation operationWithItem:downloadItem];
@weakify(self);
[self.downloadOperation resetProgressBlock:^(NSProgress *progress) {
@strongify(self);
[self resetProgressWithCompletedUnitCount:progress.completedUnitCount
totalUnitCount:progress.totalUnitCount];
} completionBlock:^(NSURL *filePath, NSError *error) {
@strongify(self);
[self resetProgressWithCompletedUnitCount:self.downloadOperation.item.completedUnitCount
totalUnitCount:self.downloadOperation.item.totalUnitCount];
}];
[self downloadStatusChanged:self.downloadOperation.item.status];
[self resetProgressWithCompletedUnitCount:self.downloadOperation.item.completedUnitCount
totalUnitCount:self.downloadOperation.item.totalUnitCount];
Expand Down
3 changes: 1 addition & 2 deletions JCNetworkingDemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ - (void)startDownload
item.groupId = JCTImageDownloadGroupId;
item.downloadUrl = [self urlList][index];
item.downloadFilePath = [JCDownloadUtilities filePathWithFileName:[item.downloadUrl lastPathComponent] folderName:@"downloadImages"];
JCDownloadOperation *operation = [[JCDownloadOperation alloc] init];
operation.item = item;
JCDownloadOperation *operation = [JCDownloadOperation operationWithItem:item];
[downloadList addObject:operation];
}
[[JCDownloadQueue sharedQueue] startDownloadList:downloadList];
Expand Down
Loading

0 comments on commit f6d7b4c

Please sign in to comment.