【发布时间】:2013-11-18 22:43:50
【问题描述】:
在我的 iOS 应用程序中,我收到以下错误:
CGContextRestoreGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
我觉得问题出在这里:
UIImage *buttonImage = [[UIImage imageNamed:@"tanButton.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(18, 6, 18, 6)];
这发生在运行 iOS7 的 iPhone 5 上。
有谁知道我该如何解决这个问题?
谢谢, 最好的问候
【问题讨论】:
-
你的按钮有什么作用?
-
这只发生在 iOS 7 目标上吗?如果您评论这一特定行,错误会消失吗?我问是因为有导致这种警告的 iOS 7 错误。从历史上看,此错误是由于在
drawRect或手动创建的CGContextRef之外调用 Core Graphics 函数导致的,但 iOS 7 中的UIKit控件会错误地生成此警告。 -
是一个按钮,调用一个函数来验证一些变量的状态。如果我将按钮更改为: UIImage *buttonImage = [UIImage imageNamed:@"tanButton.png"];问题已经解决了。但在这种情况下,我失去了想要在按钮中实现的样式。
-
这是在iOS 7上,我没有在其他目标上测试过,我会检查一下。