【问题标题】:SDWebImageManager not showing image from long and special character URLSDWebImageManager 不显示来自长和特殊字符 URL 的图像
【发布时间】:2018-09-02 10:28:02
【问题描述】:

SDWebImage 不显示来自 URL 的图像太长且带有一些特殊字符。

图片网址是:

http://akns-images.eonline.com/eol_images/Entire_Site/2018223/rs_600x600-180323073745-600-michael-davidson-fdny-032218.jpg?fit=around%7C450:350&crop=450:350;center,top&output-quality=100

[albumImageview sd_setImageWithURL:[NSURL URLWithString:aboveURL] placeholderImage:[UIImage imageNamed:placeholder] options:SDWebImageRefreshCached];

【问题讨论】:

  • 你能把代码贴在你尝试设置它的地方吗?
  • @AleksandrHoncharov 检查代码。
  • 您的图片网址应以 .jpg(或 .png 或其他格式)结尾。你试过没有?fit=around%7C450:350&crop=450:350;center,top&output-quality=100吗?
  • @Kevinosaurio 所以 SDWebImage 需要在 URL 的最后加上 .png 吗?
  • 我不确定。但是在我过去的经验中,我发现如果 url 以其他格式结尾,则图像不会下载。

标签: ios objective-c uiimageview sdwebimage


【解决方案1】:

使用以下方法

[albumImageview sd_setImageWithURL:[NSURL URLWithString:@"http://akns-images.eonline.com/eol_images/Entire_Site/2018223/rs_600x600-180323073745-600-michael-davidson-fdny-032218.jpg?fit=around%7C450:350&crop=450:350;center,top&output-quality=100"] placeholderImage:[UIImage new] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
    albumImageview.image = image;
}];

【讨论】:

    猜你喜欢
    • 2013-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    • 2014-06-04
    • 1970-01-01
    相关资源
    最近更新 更多