Question

This has been bugging me and my team for over 2 days.

We're using SDWebImage to download and display pics. PNG files always work. JPG files almost always do not show. When I convert the file to png (same name, different suffix), it is shown. I've discovered that sometimes changing the file suffix from jpg to jpeg works.

The code:

 [dataContent.imageBg setImageWithURL:[NSURL URLWithString:image]     placeholderImage:[UIImage imageNamed:@"Default.png"]options:SDWebImageRefreshCached];
Was it helpful?

Solution

Well - We've found the problem.

Apparently the mime type for .jpg reported by our server was application.jpg. .jpeg's mime type was reported correctly as image/jpeg.

As SDWebImage validates mime type (why b.t.w?), it rejected our .jpg files.

We've corrected the mime type reported by server to be image/jpeg and everything is working fine now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top