问题贴图:
截屏2021-04-30 上午11.37.32.png
查找问题方法:
Product -> Scheme -> Edit Scheme. Under the "Run" item, locate the "Arguments" tab, you'll see "Environmental Variables" in the tab, Add CG_CONTEXT_SHOW_BACKTRACE and set its value to YES.
截屏2021-04-30 上午11.49.43.png
再次运行项目,可以看到具体的定位信息
截屏2021-04-30 上午11.52.16.png
问题解决:
CGContextRef context = CGBitmapContextCreate (pixels, width, height, 8 , width * sizeof ( uint32_t ), colorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedLast );
当context 为空时,系统会报出此错误。可以判断当context为空时,直接返回原有的image
if (context == NULL) {
return mage;
}
Fix it !
网友评论