0

I'm using SDWebImage(3.8.2) for downloading some images. Here is the catch I got the URL's for the images in a JSON as normal.

However each URL (image URL) requires a JWT or it won't return the image.

On my other requests I set the JWT as such:

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
//Set Token for request
[request setValue:[[NSUserDefaults standardUserDefaults] stringForKey:@"JWTToken"] forHTTPHeaderField:@"Authorization"];

The SDWebImage code I'm using:

[imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.example.com/path/to/image"]
         placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

I took a look at SDWebImage methods but couldn't find a method that allows me to set a forHTTPHeaderField, how should I add the JWT Token to this request?

I saw this post: SDWebImage and setting custom HTTP headers?

But I was wondering is there was a "Native" Method that allowed me to do so without potentially getting my code broken on future releases.

Thanks

Community
  • 1
  • 1
ciTiger
  • 113
  • 10

0 Answers0