SDWebImage : NSURLErrorDomain - Code = 406
Posted N了歌C
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SDWebImage : NSURLErrorDomain - Code = 406相关的知识,希望对你有一定的参考价值。
Solution:Overriding request headers in SDWebImage
Looking for the file "SDWebImageDownloader.m"
replace
#ifdef SD_WEBP _HTTPHeaders = [@{@"Accept": @"image/webp,image/*;q=0.8"} mutableCopy]; #else _HTTPHeaders = [@{@"Accept": @"image/*;q=0.8"} mutableCopy]; #endif
to
#ifdef SD_WEBP _HTTPHeaders = [@{@"Accept": @"image/webp,image/*;q=0.8"} mutableCopy]; #else _HTTPHeaders = [@{@"Accept": @"image/*;q=0.8;q=0.9,*/*"} mutableCopy]; #endif
SDWebImageDownloader is a Singleton object in ios
so we could set a custom header value to ‘Accept‘ header to override the default header.
[SDWebImageDownloader.sharedDownloader setValue:@"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" forHTTPHeaderField:@"Accept"]; [self.imageView sd_setImageWithURL:[self imageUrlForId:imageId] placeholderImage:image];
以上是关于SDWebImage : NSURLErrorDomain - Code = 406的主要内容,如果未能解决你的问题,请参考以下文章
ios 在使用 SDWebimage UIButton setBackgroundimage