- [UIImage CGImage]返回零

Ort*_*ntz 3 iphone core-graphics uikit uiimage cgimage

我想知道在第二个断言中这个代码在哪些情况下中断了.换句话说,什么时候能-[UIImage CGImage]回来nil?文档在这里不是很有说服力.

- (void)setImage:(UIImage *)anImage {
    assert(anImage);
    CGImageRef cgimage = anImage.CGImage;
    assert(cgimage);
}
Run Code Online (Sandbox Code Playgroud)

我很确定,UIImage是正确的,因为它是从应用程序包中提取的.到目前为止,我还没有重现案例,但我确实看到了一些用户崩溃报告.

Fab*_*ian 6

我在文档中遇到的另一种可能性:

如果使用CIImage对象初始化UIImage对象,则该属性的值为NULL.