views:

143

answers:

1

I'm trying to call the labelWithString function and I'm getting the following run-time errors:

Error: CGContextSetGrayFillColor: invalid context 0x0

Error: CGContextTranslateCTM: invalid context 0x0

Error: CGContextScaleCTM: invalid context 0x0

This is the line of code that I tracked it down to:

self.label = [CCLabel labelWithString:@"" fontName:@"Arial" fontSize:32];

Any help on the matter would be appreciated.

A: 

Looks like the call is being made either before the CG [CoreGraphics] contexts have been initialized or potentially from the wrong thread?

Need more clues. Where does the line of code appear in your app? What is the backtrace at the time of the call?

bbum
Well, it's happening in the init function in a class that derives from CCColorLayer. It's the second thing I'm doing inside the if check to see if self exists. The thing I do before it is get the winSize from the sharedDirector.I call initWithColor:ccc4(255, 255, 255, 255) on the super, I'm not sure if this has anything to do with it, but I'm trying to give as much information as possible.The errors don't seem to affect the game, but I do want to find a fix. Keep in mind I don't have very much experience with Cocos2D, Objective-C, or the xCode compiler.
Joe1man