【iOS开发】SDWebImage框架,加载图片,失败之后,居然直接跳过不再去请求网络数据了?

    xiaoxiao2025-02-11  10

    问题描述:

    当SDWebImage 在加载图片的时候

    我用的方法是:

    (void)sd_setImageWithURL:(NSURL )url placeholderImage:(UIImage )placeholder;

    在加载过程中因为网络或别的原因造成加载失败!SDWeb把当前的图片url加入到blacklist,第二次加载这个相同的url时,它居然直接跳过不再去请求网络数据了。

    解决方案:

    使用新接口请求,同时设置options。

    (void)sd_setImageWithURL:(NSURL )url placeholderImage:(UIImage )placeholder options:(SDWebImageOptions)options;

    这个方法 options 传 SDWebImageRetryFailed 就ok了。默认是0未定义。

    转载请注明原文地址: https://ju.6miu.com/read-1296340.html
    最新回复(0)