MCDownloadManager 1.0.3

MCDownloadManager 1.0.3

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Mar 2017

Maintained by agelessman.



  • By
  • machao

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)

支持后台和锁屏下载

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];
                                                     }];

}