SDWebImage 不能加载网络图片。
2019-08-21 本文已影响0人
小六玩的并不六
发现出这个问题
<Error>: CGBitmapContextCreate: unsupported parameter combination: set CGBITMAP_CONTEXT_LOG_ERRORS environmental variable to see the details
<Error>: CGContextDrawImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
<Error>: CGBitmapContextCreateImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
解决:
add this in SDWebImageDecoder.m file:
if (!context) {
if (unsupportedColorSpace){
CGColorSpaceRelease(colorspaceRef);
}
return image;
}
after this call:
CGContextRef context = CGBitmapContextCreate(NULL, width,
height,
CGImageGetBitsPerComponent(imageRef),
0,
colorspaceRef,
kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);