這裏是我使用的代碼片段:空圖形上下文
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返回無效的圖形上下文?
您的問題中沒有足夠的信息。你有沒有看過這篇文章? http://stackoverflow.com/questions/12424690/uigraphicsgetcurrentcontext-seems-to-return-nil –