http://img5.imgtn.bdimg.com/it/u=3017210771,879699792&fm=11&gp=0.jpg
http://img5.imgtn.bdimg.com/it/u=3017210771,879699792&fm=11&gp=0.jpg
我们用SDWebImage或者YYImage加载上述url的网络图片时会发现根本无法加载,但是浏览器能够读取出来,甚至安卓端也能够读取出来,为什么iOS端就无法读取呢,原因是因为要设置User-Agent
SDWebImage:
[[SDWebImageDownloader sharedDownloader] setValue:@"iPhone" forHTTPHeaderField:@"User-Agent"];
YYImage:
NSMutableDictionary *header = [YYWebImageManager sharedManager].headers.mutableCopy;
header[@"User-Agent"] = @"iPhone"; // for example
[YYWebImageManager sharedManager].headers = header;