美文网首页
UIImageView 加载https的图片

UIImageView 加载https的图片

作者: A_Yun | 来源:发表于2023-09-06 14:19 被阅读0次

通过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:@"默认图片"]];
    }

相关文章

网友评论

      本文标题:UIImageView 加载https的图片

      本文链接:https://www.haomeiwen.com/subject/ozvkvdtx.html