-1

I'm facing the problem that every picture has different HTTP headers and I have to set it before downloading:

SDWebImageDownloader *manager = [SDWebImageManager sharedManager].imageDownloader;
[manager @"value" forHTTPHeaderField:@"key];
[self.imageView sd_setImageWithURL:[NSURL URLWithString:str]];

But when I set many pictures, only the last picture can be loaded. How can I solve this problem?

Pang
  • 9,564
  • 146
  • 81
  • 122
zhongdom
  • 19
  • 3

2 Answers2

0

Try to use SDWebImageManager.sharedManager.imageDownloader.headersFilter

kean
  • 1,561
  • 14
  • 22
  • Think you for your answer ! I found another solution.But I don't know how reply it at comment,so I wrtie another answer. – zhongdom Sep 12 '15 at 04:07
0

I have found a solution from sdwebimage issue.

SDWebImageManager.sharedManager.imageDownloader.headersFilter  = ^NSDictionary *(NSURL *url, NSDictionary *headers)
{
    NSMutableDictionary *mutableHeaders = [headers mutableCopy];

    [mutableHeaders removeObjectForKey:@"your key"];

    [mutableHeaders setValue:@"your value" forKey:@"your key"];

    return mutableHeaders;
};

By this way,you can set differrent HTTP header for each image.

zhongdom
  • 19
  • 3