Problem: I present a UIAlertController and get a whole slew of CGContext-related error messages in the console. There are three errors that each repeat 15 - 20 times so it looks like the console blew up! These error messages only occur when triggering the Alert in some places in my app - not in others. In all cases, the UIAlertController still displays just fine despite the error warnings. I'm not doing any custom drawing/animation. Nowhere in my code do I use anything to do with CGContext.
I'm using XCode 6.4 and iOS 8. This happens in the simulator and on device (iPad)
Any thoughts on what's causing the error messages and why it would happen in only certain sections of my app?
I looked at these posts but no luck:
invalid context 0x0 under iOS 7.0 and system degradation
I also tried setting a CGPostError symbolic breakpoint but it just shows me assembly language - nothing useful.
Here are the three CGContext errors that get repeated upon each presentation of UIAlertController:
Error: CGContextAddPath: 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: clip: 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: CGContextDrawLinearGradient: 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.`
Code used to present UIAlertController. self
is a UIViewController
. This could be triggered from a button press, or selecting a tableview cell, etc.:
let alert = UIAlertController(title: "TEST", message: "test", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Cancel, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)