Replaced #1345 - Added urlCredential property to SDWebImageDownloader

This commit is contained in:
Bogdan Poplauschi 2015-10-25 15:57:52 +02:00
parent 3b9c09142a
commit dcb7985c5c
2 changed files with 8 additions and 1 deletions

View File

@ -109,6 +109,11 @@ typedef NSDictionary *(^SDWebImageDownloaderHeadersFilterBlock)(NSURL *url, NSDi
*/
+ (SDWebImageDownloader *)sharedDownloader;
/**
* Set the default URL credential to be set for request operations.
*/
@property (strong, nonatomic) NSURLCredential *urlCredential;
/**
* Set username
*/

View File

@ -172,7 +172,9 @@ static NSString *const kCompletedCallbackKey = @"completed";
}];
operation.shouldDecompressImages = wself.shouldDecompressImages;
if (wself.username && wself.password) {
if (wself.urlCredential) {
operation.credential = wself.urlCredential;
} else if (wself.username && wself.password) {
operation.credential = [NSURLCredential credentialWithUser:wself.username password:wself.password persistence:NSURLCredentialPersistenceForSession];
}