Sdwebimage:nsurlerrordomain-code = 406

Source: Internet
Author: User

Solution:overriding Request headers in Sdwebimage

Looking for the file "SDWEBIMAGEDOWNLOADER.M"

Replace

#ifdef SD_WEBP         = [@{@ "Accept"@ "image/webp,image/*;q=0.8"} mutablecopy ]; #else = [@{@ "Accept" @ "image/*;q=0.8"            } mutablecopy]; #endif

To

#ifdef SD_WEBP         = [@{@ "Accept"@ "image/webp,image/*;q=0.8"} mutablecopy ]; #else  = [@{@ "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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.