美文网首页
iOS开发 -- CGContextDrawImage: inv

iOS开发 -- CGContextDrawImage: inv

作者: 想飞的菜鸟 | 来源:发表于2021-04-30 11:57 被阅读0次

问题贴图:


截屏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 !

相关文章

网友评论

      本文标题:iOS开发 -- CGContextDrawImage: inv

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