Latest 1.0.2
Homepage https://github.com/QianChia/QSessionDownloader
License MIT
Platforms ios 7.0, requires ARC
Authors

Logo

  • A simple encapsulation of NSURLSession files to download.

GitHub:QianChia | Blog:QianChia(Chinese)


Installation

From CocoaPods

  • pod 'QSessionDownloader'

Manually

  • Drag all source files under floder QSessionDownloader to your project.
  • Import the main header file:#import "QSessionDownloader.h"

Examples

  • Start Download

    
        [[QSessionDownloader defaultDownloader] q_downloadWithURL:url progress:^(float progress) {
    
            dispatch_async(dispatch_get_main_queue(), ^{
                ];
            });
    
        } successed:^(NSString *targetPath) {
    
            NSLog(@"文件下载成功:%@", targetPath);
    
        } failed:^(NSError *error) {
    
            if ([error.userInfo[NSLocalizedDescriptionKey] isEqualToString:@"pauseDownload"]) {
    
                NSLog(@"暂停下载");
    
            } else if ([error.userInfo[NSLocalizedDescriptionKey] isEqualToString:@"cancelDownload"]) {
    
                NSLog(@"取消下载");
    
            } else {
    
                NSLog(@"文件下载失败:%@", error.userInfo[NSLocalizedDescriptionKey]);
            }
        }];
    
  • Pause Download

    
        [[QSessionDownloader defaultDownloader] q_pauseWithURL:url];
    
  • Cancel Download

    
        [[QSessionDownloader defaultDownloader] q_cancelWithURL:url];
    

Latest podspec

{
    "name": "QSessionDownloader",
    "version": "1.0.2",
    "platforms": {
        "ios": "7.0"
    },
    "license": "MIT",
    "homepage": "https://github.com/QianChia/QSessionDownloader",
    "authors": {
        "QianChia": "[email protected]"
    },
    "summary": "A simple encapsulation of NSURLSession files to download",
    "source": {
        "git": "https://github.com/QianChia/QSessionDownloader.git",
        "tag": "1.0.2"
    },
    "source_files": "QSessionDownloader",
    "requires_arc": true
}

Pin It on Pinterest

Share This