Search code examples
warningsosx-mountain-lion

"Does not make sense to draw an image" - Warning after upgrade to MountainLion


After I upgraded my programming machine to MountainLion and XCode to the new version I get this warning printed into the console everytime I run my application:

It does not make sense to draw an image when [NSGraphicsContext currentContext] is nil. This is a programming error. Break on void _NSWarnForDrawingImageWithNoCurrentContext() to debug. This will be logged only once. This may break in the future.

I'm not using an Image anywhere in my Application and I searched the whole project for an image but couldn't find one. Does anybody know what could cause this?

I'm using 2 nib files btw: One Popover and the Mainwindow. Neither of them contains an image.

Edit: I found the line when this appears:

    [self.popover showRelativeToRect:[appDelegate.menulet frame] 
                              ofView:appDelegate.menulet 
                       preferredEdge:NSMinYEdge];

But none of those object is nil. Any suggestions?

Edit 2: The Menulet is a NSView subclass btw. So I'm passing a view.


Solution

  • In my case the warning resulted in rewriting my menuIcon with a rectangle (Working on a menuBar application). Haven't solved the problem yet, but I know where it came from in my case. If you have a menubar application, check the code which generates your icon.