FGGDownloader 1.1

FGGDownloader 1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2016

Maintained by CGPointZero.



  • By
  • CGPointZero

FGGDownloadManager

用于断点续传,退出程序后,下次启动后,恢复下载从上次下载位置开始下载

演示

FGGDownloadManager用法简介

---------------------------------------------------------------------------------------------

基于UNSURLConnection封装的断点续传类,用于大文件下载,退出程序后,下次启动接着下载。


Install:

Cocopods:

pod 'FGGDownloader', '~> 1.0'

Manual:

download FGGDownloader and drag it into project。

Useage:

-->1.在项目中导入FGGDownloadManager.h头文件;
-->2.搭建UI时,设置显示进度的UIProgressView的进度值:[[FGGDownloadManager sharedManager] lastProgressWithUrl:url],
这个方法的返回值是float类型的;
设置显示文件大小/文件总大小的Label的文字:[[FGGDownloadManager sharedManager]fileSize:url];

-->3.开始或恢复下载任务的方法:[FGGDownloadManager sharedManager] downloadWithUrlString:(NSString *)urlString
toPath:(NSString *)destinationPath
process:(ProcessHandle)process
completion:(CompletionHandle)completion
failure:(FailureHandle)failure];

Explain

这个方法包含三个回调代码块,分别是:

1)下载过程中的回调代码块,带3个参数:下载进度参数progress,已下载文件大小sizeString,文件下载速度speedString;
2)下载成功回调的代码块,没有参数;
3)下载失败的回调代码块,带一个下载错误参数error。

-->4.在下载出错的回调代码块中处理出错信息。在出错的回调代码块中或者暂停下载任务时,
调用[[FGGDownloadManager sharedManager] cancelDownloadTask:url]方法取消/暂停下载任务;

================================================================================
Copyright(c) 2016 CGPointZero. All rights reserved.