我想知道在什么情况下这段代码会在第二个断言中中断。换句话说,什么时候可以-[UIImage CGImage]
返回nil
?文档在这里不是很能说明问题。
- (void)setImage:(UIImage *)anImage {
assert(anImage);
CGImageRef cgimage = anImage.CGImage;
assert(cgimage);
}
我很确定, UIImage 是正确的,因为它是从应用程序包中获取的。到目前为止,我还无法重现此案例,但我确实看到了一些用户崩溃报告。