【发布时间】:2014-04-07 22:27:26
【问题描述】:
这是我正在使用的代码摘录:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^
{
UIGraphicsBeginImageContextWithOptions(irect.size, YES, 0.0 );
CGContextRef context = UIGraphicsGetCurrentContext();
if (context == 0)
NSLog (@"Null Graphics Context") ;
else
NSLog (@"OK") ;
. . . .
// Various drawing functions
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}) ;
我发现对 UIGraphicsGetCurrentContext 的所有其他调用都返回 NULL。我在控制台上收到此消息。
CGContextRestoreGState:无效的上下文 0x0。这是一个严重的错误。此应用程序或它使用的库正在使用无效的上下文,从而导致系统稳定性和可靠性的整体下降。此通知是出于礼貌:请解决此问题。这将在即将到来的更新中成为致命错误。
什么会导致 UIGraphicsGetCurrentContext 返回无效的图形上下文?
【问题讨论】:
-
您的问题中没有足够的信息。你看过这个帖子吗? stackoverflow.com/questions/12424690/…
标签: ios uigraphicscontext