SDWebImage: SdWebImage gives “Error Domain=NSURLErrorDomain Code” A server with the specified hostname could not be found"
Generating an image call using:
[cell.i_imageView sd_setImageWithURL:[NSURL URLWithString: item.PostimageUrl] placeholderImage:[UIImage imageNamed:@""] options: SDWebImageRefreshCached progress:nil completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
if(!image)
NSLog(@"image not loaded %@", error.description);
In most cases the image loads fine, but in some cases sdwebimage gives this error code=-1003 “A server with the specified hostname could not be found”.
After much research I have found out it’s a DNS-related issue and have tested this theory out by using the following methods,
VPN on an actual device Disconnect the WIFI and use 3G/LTE To which the images loaded fine. but I can’t be betting on both these above mentioned methods while shipping the product, so any workaround or any SdWebImage methods am I missing here that solves the problem.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (5 by maintainers)
@bpoplauschi @rs @zhongwuzw @matej @kinarobin @akhenakh @mythodeia @robertmryan @mattjgalloway
That’s precisely why I’m saying it’s not an SDWebImage issue. It’s your internet. If other connections work then it’s the one that doesn’t work which, well, doesn’t work.