WeexSDK中图片加载使用第三方SDWebImage,跳过证书验证
之前weex加载图片的文章 不重复
WXImgLoaderDefaultImpl.m文件
通过证书验证源码如下:
- (id)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 )[[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
如下图:
参考: