vanditmehta / MZDownloadManager

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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

For swift check the swift branch. For objective-c check the master branch.

MZDownloadManager

mzdownload manager hero

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;

About

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


Languages

Language:Objective-C 100.0%