"It makes no sense to draw an image" - warning after upgrading to MountainLion

After I upgrade my programming machine to MountainLion and Xcode to a new version, I get this warning printed in the console every time I launch my application:

It makes no sense to draw an image when [NSGraphicsContext currentContext] is zero. This is a programming error. Break on void _NSWarnForDrawingImageWithNoCurrentContext () for debugging. This will be recorded only once. It may break in the future.

I do not use the image anywhere in my application, and I searched the entire project for the image, but could not find it. Does anyone know what might cause this?

I use 2 nib btw files: One Popover and Mainwindow. None of them contain images.

Edit: I found a line when this appears:

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

But none of these objects is equal to zero. Any suggestions?

Edit 2: Menulet is a subclass of NSView. Therefore, I am viewing the presentation.

+5
source share
4 answers

In my case, the warning led to rewriting my menuIcon with a rectangle (Working on the menuBar application). The problem has not been solved yet, but I know where it came from in my case. If you have a text application, check the code that your icon generates.

0
source

, , . . , , . NSOutlineView. NSOutlineView, .

, , NIB . , .

+1

NSImageView, nib, ( ) , .

+1

In my case, this is because the size of the image is {0,0}, which "makes no sense." Actually, the image for NSButton, I change the button image programmatically. In one case, the button should be blank, so I just set the blank image with [NSImage new]. But an error occurs, then no matter how I change the image of the button, the button is always empty. After setting the size for the blank image, the problem is resolved, and I can successfully change the button image.

+1
source

All Articles