Inherits from NSObject
Declared in SDWebImageDownloader.h

Overview

Asynchronous downloader dedicated and optimized for image loading.

Tasks

Properties

currentDownloadCount

@property (readonly, nonatomic) NSUInteger currentDownloadCount
Discussion

Shows the current amount of downloads that still need to be downloaded

Declared In

SDWebImageDownloader.h

downloadTimeout

@property (assign, nonatomic) NSTimeInterval downloadTimeout
Discussion

The timeout value (in seconds) for the download operation. Default: 15.0.

Declared In

SDWebImageDownloader.h

executionOrder

@property (assign, nonatomic) SDWebImageDownloaderExecutionOrder executionOrder
Discussion

Changes download operations execution order. Default value is SDWebImageDownloaderFIFOExecutionOrder.

Declared In

SDWebImageDownloader.h

headersFilter

@property (nonatomic, copy) SDWebImageDownloaderHeadersFilterBlock headersFilter
Discussion

Set filter to pick headers for downloading image HTTP request.

This block will be invoked for each downloading image request, returned NSDictionary will be used as headers in corresponding HTTP request.

Declared In

SDWebImageDownloader.h

maxConcurrentDownloads

@property (assign, nonatomic) NSInteger maxConcurrentDownloads

password

@property (strong, nonatomic) NSString *password
Discussion

Set password

Declared In

SDWebImageDownloader.h

shouldDecompressImages

@property (assign, nonatomic) BOOL shouldDecompressImages
Discussion

Decompressing images that are downloaded and cached can improve peformance but can consume lot of memory. Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption.

Declared In

SDWebImageDownloader.h

username

@property (strong, nonatomic) NSString *username
Discussion

Set username

Declared In

SDWebImageDownloader.h

Class Methods

sharedDownloader

+ (SDWebImageDownloader *)sharedDownloader
Discussion

Singleton method, returns the shared instance

Return Value

global shared instance of downloader class

Declared In

SDWebImageDownloader.h

Instance Methods

downloadImageWithURL:options:progress:completed:

- (id<SDWebImageOperation>)downloadImageWithURL:(NSURL *)url options:(SDWebImageDownloaderOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageDownloaderCompletedBlock)completedBlock
Discussion

Creates a SDWebImageDownloader async downloader instance with a given URL

The delegate will be informed when the image is finish downloaded or an error has happen.

Parameters

url

The URL to the image to download

options

The options to be used for this download

progressBlock

A block called repeatedly while the image is downloading

completedBlock

A block called once the download is completed. If the download succeeded, the image parameter is set, in case of error, error parameter is set with the error. The last parameter is always YES if SDWebImageDownloaderProgressiveDownload isn’t use. With the SDWebImageDownloaderProgressiveDownload option, this block is called repeatedly with the partial image object and the finished argument set to NO before to be called a last time with the full image and finished argument set to YES. In case of error, the finished argument is always YES.

Return Value

A cancellable SDWebImageOperation

Declared In

SDWebImageDownloader.h

setOperationClass:

- (void)setOperationClass:(Class)operationClass
Discussion

Sets a subclass of SDWebImageDownloaderOperation as the default NSOperation to be used each time SDWebImage constructs a request operation to download an image.

Parameters

operationClass

The subclass of SDWebImageDownloaderOperation to set as default. Passing nil will revert to SDWebImageDownloaderOperation.

Declared In

SDWebImageDownloader.h

setSuspended:

- (void)setSuspended:(BOOL)suspended
Discussion

Sets the download queue suspension state

Declared In

SDWebImageDownloader.h

setValue:forHTTPHeaderField:

- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field
Discussion

Set a value for a HTTP header to be appended to each download HTTP request.

Parameters

value

The value for the header field. Use nil value to remove the header.

field

The name of the header field to set.

Declared In

SDWebImageDownloader.h

valueForHTTPHeaderField:

- (NSString *)valueForHTTPHeaderField:(NSString *)field
Discussion

Returns the value of the specified HTTP header field.

Return Value

The value associated with the header field field, or nil if there is no corresponding header field.

Declared In

SDWebImageDownloader.h