Objective-c – CGContext invalid context 0x0

ios7objective c

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

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

and similar errors repeated with:

  • CGContextSaveGState
  • CGContextSetFlatness
  • CGContextAddPath
  • CGContextDrawPath
  • CGContextRestoreGState
  • CGContextSaveGState
  • CGContextSetFlatness
  • CGContextAddPath
  • CGContextDrawPath
  • CGContextRestoreGState
  • CGContextSetFillColorWithColor
  • CGContextSetStrokeColorWithColor
  • CGContextSetFillColorWithColor
  • CGContextSetStrokeColorWithColor
  • CGContextGetBlendMode
  • CGContextSetBlendMode
  • and more…

In my App, I do not use any CGContext stuff. I just have a UITextView, UIButton and UILabel. Not much codes added yet. Just set the content of UITextView by:

[self.text_view setText:@"123"];

How to resolve the error ?

I'm using Xcode 5.0 (build 5A1413), iOS 7 Simulator (64-bit Retina 4"), Mac OS X 10.8.5

Best Answer

Try this: In xcode add symbolic breakpoint to CGPostError. (Add symbolic breakpoint, and to Symbol field type CGPostError)

When error happen, debugger will stop code executions and you can check stack of methods calls and check parameters.

Related Topic