MZDownloadManager

mzeeshanidBSD-3-Clause活跃维护

基于 NSURLSession 的 iOS 下载管理器,支持多文件并发下载、后台下载大文件,以及应用退出后断点续传。

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.

3.3发布于 2017-04-27 09:27 UTC1,117star233fork同步于 2026-11-07 07:34 UTC

怎么上手

由 README 提炼,执行前请确认
pod "MZDownloadManager"
硬件要求按 README 说明

README 未说明;仅要求 iOS 9 及以上部署目标与 Xcode 8

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 URLSession 的 iOS 下载管理库,支持后台下载、多任务并发与断点续传

基于 NSURLSession 的 iOS 下载管理器,支持多文件并发下载、后台下载大文件,以及应用退出后断点续传。

核心能力

  • 用 URLSession 实现文件下载
  • 支持 App 在后台时下载大文件
  • 可同时下载多个文件
  • 支持中断后续传与手动暂停
  • 下载出错后可重试任务

容易踩的坑

断点续传要求下载服务器本身支持 resuming;示例工程需先进入 Example 目录执行 pod install;自定义路径下载时若目标文件夹不存在,需实现 downloadRequestDestinationDoestNotExists 代理,否则走失败回调

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本3.3
  1. 3.3Bug fixes + improvements最新正式版2017-04-27 · 2017-04-27 09:27 UTC

    Fixed crashing issues and made some improvements.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    MZDownloadManager

    CI Status Version License Platform

    mzdownload manager hero

    Features

    This download manager uses the URLSession api to download files.

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

    Usage

    To run the example project, clone the repo, and run pod install from the Example directory first.

    Requirements

    • Xcode 8
    • Minimum deployment target is iOS 9.
    • For resuming downloads server must have resuming support.

    Installation

    MZDownloadManager is available through CocoaPods. To install it, simply add the following line to your Podfile:

    pod "MZDownloadManager"
    

    To install it by using Swift Package Manager:

    Update

    New helper functions added to support downloading at custom path. Example project is also updated about the usage.

    To download file at custom path you can use the following instance method of MZDownloadManager:

    public func addDownloadTask(fileName: String, fileURL: String, destinationPath: String)

    When download completes:

    • It will check if the destination folder still exists then it will move the downloaded file at the specified destination and call success delegate method.
    • If destination folder does not exists, following delegate method will provide an opportunity to handle the downloaded file appropriately.

    optional func downloadRequestDestinationDoestNotExists(downloadModel: MZDownloadModel, index: Int, location: NSURL)

    • If the above delegate method is not implemented then it will just called the failure method.

    Important: This delegate method will be called on the session's queue.

    Try In a Live App

    MZDownloadManager is used in MZFileManager app. To learn more about the app features, visit this page.

    Author

    Muhammad Zeeshan, [email protected]

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

    License

    MZDownloadManager is available under the BSD license. See the LICENSE file for more info.