CGContextSaveGState: invalid context 0x0

I know this has been an issue that apple says they know is a bug but it still seems to be an issue in the xcode 7 GM release, Everything works fine, but is there any chance of getting ride of these errors.



<Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

<Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

<Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.


I tried messing around with the status bar as the apple employee thought it had something to do with that, hiding it, showing it, but it happens before any code is even executed. Like i said not a huge issue, but its useless "error". As a side note im not using playgrounds this is regular IB

Replies

Remove

UIViewControllerBasedStatusBarAppearance (View controller-based status bar appearance)
from Info.plist fixed it for me.


This answer was give me from another forum (stackoverfow)

This removes the error messages but it puts the status bar back on the screen. Any suggestions as to how to remove the error messages AND remove the status bar?

Thanks.

https://forums.developer.apple.com/thread/18521


There's a workaround in this thread


Quote:

The issue seems to be bound to entry

UIViewControllerBasedStatusBarAppearance

in your app's info.plist file.

If you remove it and use the UIViewController's method to set your status bar style on a VC basis.


  1. - (UIStatusBarStyle)preferredStatusBarStyle {
  2. return UIStatusBarStyleLightContent;
  3. }