Skip to content

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

Notifications You must be signed in to change notification settings

SimmonHou/MZDownloadManager

 
 

Repository files navigation

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;

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 100.0%