Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Insfgg99x/FGDownloader

Open more actions menu

Repository files navigation

FGGDownloadManager

断点续传下载文件,文件上传显示进度

Version License Platform

Usage

  • download
/**
*  断点下载(get)
*
*  @param  urlString        下载的链接
*  @param  destinationPath  下载的文件的保存路径
*  @param  process         进度的回调,会多次调用
*  @param  completion      下载完成的回调
*  @param  failure         下载失败的回调
*/
- (void)downloadUrl:(NSString *)urlString
             toPath:(NSString *)destinationPath
            process:(FGProcessHandle)process
         completion:(FGCompletionHandle)completion
            failure:(FGFailureHandle)failure;

/**
*  断点下载(post)
*
*  @param  host            下载的链接
*  @param  p               post参数
*  @param  destinationPath 下载的文件的保存路径
*  @param  process         进度的回调,会多次调用
*  @param  completion      下载完成的回调
*  @param  failure         下载失败的回调
*/
- (void)downloadHost:(NSString *)host
               param:(NSString *)p
              toPath:(NSString *)destinationPath
             process:(FGProcessHandle)process
          completion:(FGCompletionHandle)completion
             failure:(FGFailureHandle)failure;
  • upload
/**
*  上传
*  @param  host        服务器地址
*  @param  data        文件二进制数据
*  @param  p           post请求的参数
*  @param  fileName    文件名(如1.jpg)
*  @param  name        服务器文件的变量名
*  @param  mimeType    文件的mimeType(如image/jpeg)
*  @param  process     进度的回调(会多次调用)
*  @param  completion  成功的回调
*  @param  failure     失败的回调
*/
- (void)upload:(NSString *)host
        parama:(NSDictionary *)p
          file:(NSData *)data
      mimeType:(NSString *)type
      fileName:(NSString *)n1
          name:(NSString *)n2
       process:(FGProcessHandle)process
    completion:(FGUploadCompletionHandle)completion
       failure:(FGFailureHandle)failure;

Install

  • Cocopods
pod repo update
pod 'FGGDownloader', '~> 2.2'
pod install
  • Manual 下载 FGGDownloader 并引入项目,导入FGHeader.h文件
Morty Proxy This is a proxified and sanitized view of the page, visit original site.