TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
Depends on: | |
EGOCache | ~> 2.0 |
AFNetworking | ~> 1.3 |
Download a set of files in parallel or sequential order.
Ever wanted to download a set of images in a parallel or sequential order, like creating a table cell view that resembles Facebook timeline cell that contains multiple images. If you tried to create such thing, then you realised that some images has to be downloaded before the others, namely the first image in the timeline cell must be downloaded before the second image in this same cell (remember we have multi images inside the same cell)
IADownloadManager, will help you download images or any other files in a parallel order. IASequentialDownloadManager, will help you download a set of urls in a sequential order.
To use the download manager you should have:
Third party needed (included within the sources of the project):
CFNetwork.framework
and Security.framework
to the project, if you are not sure on how to add frameworks read the following SO answer
Every download operation is identified by the NSURL of the file that is getting downloaded, The NSURL will be unique and cached against.
Start the download operation
//Start the download operation, if the download operation is already started for this url,
//the urls will never be downloaded twice
[IADownloadManager downloadItemWithURL:url useCache:YES];
Attach Listener
//Attach a listener to the url
[IADownloadManager attachListener:self toURL:url];
Detach Listener
//Detach a listener to the url
[IADownloadManager detachListener:self];
Delegate methods
- (void)downloadManagerDidProgress:(float)progress;
- (void)downloadManagerDidFinish:(BOOL)success response:(id)response;
Start the download operation
//Start the download operation, if the download operation is already started for these urls,
//the urls will never be downloaded twice
[IASequentialDownloadManager downloadItemWithURLs:urls useCache:YES];
Attach Listener
//Attach a listener to the urls
[IASequentialDownloadManager attachListener:self toURLs:urls];
Detach Listener
//Detach a listener to the url
[IASequentialDownloadManager detachListener:self];
Delegate methods
- (void)sequentialManagerProgress:(float)progress atIndex:(int)index;
- (void)sequentialManagerDidFinish:(BOOL)success response:(id)response atIndex:(int)index;
There are also a set of blocks to be informed about the event of the download, For blocks based callbacks please refer to the demo.