GithubHelp home page GithubHelp logo

danghung24031992 / mzdownloadmanager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mzeeshanid/mzdownloadmanager

0.0 1.0 0.0 282 KB

This download manager uses NSURLSession api to download files. It can download multiple files at a time. It can download large files if app is in background. It can resume downloads if app was quit.

License: BSD 3-Clause "New" or "Revised" License

Objective-C 100.00%

mzdownloadmanager's Introduction

For swift checkout the swift branch.

For objective-c checkout the master branch.

MZDownloadManager

mzdownload manager hero

If you find MZDownloadManager userful consider donating thanks ;)
Donate button

Features:

This download manager uses the iOS 7 NSURLSession api to download files.

  1. Can download large files if app is in background.
  2. Can download files if app is in background.
  3. Can download multiple files at a time.
  4. It can resume interrupted downloads.
  5. User can also pause the download.
  6. User can retry any download if any error occurred during download.

Requirements:

  1. Please note that for resuming downloads server must have resuming support.
  2. Please note that by using this control your app minimum deployment target will be iOS 7.

Screencast:

http://screencast.com/t/Rzm0xoRjGF

Usage:

See the demo project it is very simple and straight forward. Steps: Copy all files from MZDownloadManager group from sample project.
  1. Setup your available downloads view controller.
  2. Initialize MZDownloadManagerViewController and set its delegate. Initialize its downloading array and setup background session configuration. Interrupted downloads can be restore by instance method.
  3. - (void)populateOtherDownloadTasks
    All steps will look like the following:
    UINavigationController *mzDownloadingNav = [self.tabBarController.viewControllers objectAtIndex:1];
    mzDownloadingViewObj = [mzDownloadingNav.viewControllers objectAtIndex:0];
    [mzDownloadingViewObj setDelegate:self];
    

    mzDownloadingViewObj.downloadingArray = [[NSMutableArray alloc] init]; mzDownloadingViewObj.sessionManager = [mzDownloadingViewObj backgroundSession]; [mzDownloadingViewObj populateOtherDownloadTasks];

    Please note that i am using tab based application in sample project.

  4. To add new download task you can use the instance method of MZDownloadManagerViewController.
    - (void)addDownloadTask:(NSString *)fileName fileURL:(NSString *)fileURL;
  5. Use 3 delegate methods
    A delegate method called each time whenever new download task is start downloading.
    - (void)downloadRequestStarted:(NSURLSessionDownloadTask *)downloadTask;
    A delegate method called each time whenever any download task is cancelled by the user.
    - (void)downloadRequestCanceled:(NSURLSessionDownloadTask *)downloadTask;
    A delegate method called each time whenever any download task is finished successfully.
    - (void)downloadRequestFinished:(NSString *)fileName;

mzdownloadmanager's People

Contributors

mzeeshanid avatar

Watchers

Đăng Hưng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.