A simple and convenient multi task download manager
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
MCDownloadManager.xcodeproj
MCDownloadManager
LICENSE
MCDownloadManager.podspec
README.md

README.md

MCDownloadManager

A simple and convenient multi task download manager

Attention

这个版本默认只支持同时下载10个文件 This version only supports 10 file downloads at the same time.

若要支持更多,请修改下边的代码

configuration.HTTPMaximumConnectionsPerHost = 10;

添加了速度提示(比如:400KB/s)

支持后台和锁屏下载

Installation

Cocoapods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build MCDownloadManager 1.0.0+.

To integrate MCDownloadManager into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'MCDownloadManager', '~> 1.0.3'

Then, run the following command:

$ pod install

Usage

- (void)download {
    [[MCDownloadManager defaultInstance] downloadFileWithURL:self.url
                                                    progress:^(NSProgress * _Nonnull downloadProgress, MCDownloadReceipt *receipt) {
                                                        
                                                        if ([receipt.url isEqualToString:self.url]) {
                                                            self.progressView.progress = downloadProgress.fractionCompleted ;
                                                        }
                                    
                                                    }
                                                 destination:nil
                                                     success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSURL * _Nonnull filePath) {
                                                         [self.button setTitle:@"播放" forState:UIControlStateNormal];
                                                     }
                                                     failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
                                                         [self.button setTitle:@"重新下载" forState:UIControlStateNormal];
                                                     }];

}