美文网首页
无证书 SDWebImage访问HTTPS获取图片失败

无证书 SDWebImage访问HTTPS获取图片失败

作者: GalaxyJM | 来源:发表于2017-01-03 16:44 被阅读321次

1.全局修改 修改SDWebImage 源码
UIImageView+WebCache.m文件

- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock {}

方法里添加options | SDWebImageAllowInvalidSSLCertificates

 id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options | SDWebImageAllowInvalidSSLCertificates progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
}

直接跳过验证证书

2.局部修改

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

相关文章

网友评论

      本文标题:无证书 SDWebImage访问HTTPS获取图片失败

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