문제

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];
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top