Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Powerful and easy-to-use file download manager based on NSURLSession. Provide download status, progress and completion callback block.

License

NotificationsYou must be signed in to change notification settings

guowilling/SRDownloadManager

Repository files navigation

Powerful and easy-to-use file download manager based on NSURLSession. Provide download status, progress and completion callback block.

image

Features

  • Support breakpoint download even exit the App and multitasking download at the same time.
  • Support to customize the directory to save files or specify the path to save file.
  • Support to set maximum concurrent downloads and waiting for download queue mode.
  • Support to delete file by URL or name and clear all files that have been downloaded.

Installation

CocoaPods

Addpod 'SRDownloadManager' to the Podfile, then runpod install in the terminal.

Manual

Drag theSRDownloadManager folder to the project.

APIs

/** Starts a file download action with URL, download state, download progress and download completion block. @param URL        The URL of the file which to be downloaded. @param destPath   The path to save the file after the download is completed, if pass nil file will be saved in default path. @param state      A block object to be executed when the download state changed. @param progress   A block object to be executed when the download progress changed. @param completion A block object to be executed when the download completion.*/- (void)download:(NSURL *)URL        destPath:(NSString *)destPath           state:(void (^)(SRDownloadState state))state        progress:(void (^)(NSInteger receivedSize,NSInteger expectedSize, CGFloat progress))progress      completion:(void (^)(BOOL success,NSString *filePath,NSError *error))completion;

Usage

[[SRDownloadManagersharedManager]download:URLdestPath:nilstate:^(SRDownloadState state) {// Called when the download state changed.}progress:^(NSInteger receivedSize,NSInteger expectedSize, CGFloat progress) {// Called when the download progress changed.}completion:^(BOOL success,NSString *filePath,NSError *error) {// Called when the download completion.}];

Custom

/** The directory where downloaded files are cached, default is .../Library/Caches/SRDownloadManager if not setted.*/@property (nonatomic, copy)NSString *cacheFilesDirectory;/** The count of max concurrent downloads, default is -1 which means no limit.*/@property (nonatomic, assign)NSInteger maxConcurrentCount;/** The mode of waiting download queue, default is FIFO.*/@property (nonatomic, assign) SRWaitingQueueMode waitingQueueMode;

Contacts

Submit an issue or email me if you have any questions.guowilling90@gmail.com

About

Powerful and easy-to-use file download manager based on NSURLSession. Provide download status, progress and completion callback block.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp