<error>:CGContextSaveGState,CGContextSetStyle,CGContextRestoreGState:无效的上下文0x0 </error>

时间:2013-11-08 20:06:54

标签: ios iphone runtime-error

我已经看到了这个问题,但似乎没有人能够找到一个通用的解决方案。我的3个错误就是

<Error>: CGContextSaveGState: 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.

<Error>: CGContextSetStyle: 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.

<Error>: 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.

我的应用程序仍然运行并且运行良好。但我想知道我是否应该担心或担心这一点。

仅供参考,我正在运行Xcode 5.0.1并且应用程序已设置为iOS 7.我在viewcontroller上导致错误弹出的库是:

In the .h
#import <UIKit/UIKit.h>
#import "Event.h"
#import <MessageUI/MessageUI.h>
#import <EventKit/EventKit.h>
#import <EventKitUI/EventKitUI.h>

In the .m
#import "EventDetailsViewController.h"
#import "XMLReader.h"
#import <Twitter/Twitter.h>
#import "AppDelegate.h"
#import "FBShareViewController.h"
#import <MapKit/MapKit.h>

由于

2 个答案:

答案 0 :(得分:1)

如果您想从UIView获取UIImage,请确保您的UIView具有正确的框架集。它的高度或宽度不应为0。

答案 1 :(得分:0)

接受@Rob建议,我去寻找任何类似的方法,遗憾的是,我有一个drawRect方法被调用。我评论了它,运行代码,并且中提琴,没有任何错误地运行。看起来它不会动态创建新的上下文,或者是我们必须要处理的事情。