UIImageView 加载https的图片

2023-09-06  本文已影响0人  A_Yun

通过SDWebImage内部的枚举选择需要的类型

image.png
有一个信任ssl的类型: SDWebImageAllowInvalidSSLCertificates, 其实就是允许不受信任的 SSL 证书。
image.png

根据实际需求,选择加载网络图片的方法

if ([url hasPrefix:@"https"]) { //加载https的图片
        [self.iconPhoto sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"默认图片"] options:SDWebImageAllowInvalidSSLCertificates];
    } else {
        [self.iconPhoto sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"默认图片"]];
    }
上一篇 下一篇

猜你喜欢

热点阅读