Weex 图片下载使用第三方SDWebImage,跳过证书验证

WeexSDK中图片加载使用第三方SDWebImage,跳过证书验证

之前weex加载图片的文章  前半部分加载网络图片 不重复

WXImgLoaderDefaultImpl.m文件

通过证书验证源码如下:

- (id<WXImageOperationProtocol>)downloadImageWithURL:(NSString *)url imageFrame:(CGRect)imageFrame userInfo:(NSDictionary *)userInfo completed:(void(^)(UIImage *image,  NSError *error, BOOL finished))completedBlock
{
    
    if ([url hasPrefix:@"//"]) {
        url = [@"http:" stringByAppendingString:url];
    }
    
    return (id<WXImageOperationProtocol>)[[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:url] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {

    } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
        if (completedBlock) {
            completedBlock(image, error, finished);
        }
    }];
    
}

不认证证书需要更改options,0改为

SDWebImageAllowInvalidSSLCertificates

如下图:

参考:

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

猜你喜欢

转载自www.cnblogs.com/lulushen/p/9629285.html
今日推荐