“绘制图像没有意义"- 升级到 MountainLion 后的警告 [英] "Does not make sense to draw an image" - Warning after upgrade to MountainLion
问题描述
在我将我的编程机器升级到 MountainLion 并将 XCode 升级到新版本后,我每次运行应用程序时都会在控制台中打印此警告:
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:
当 [NSGraphicsContextcurrentContext] 为零.这是一个编程错误.破空_NSWarnForDrawingImageWithNoCurrentContext() 进行调试.这将只记录一次.这在未来可能会中断.
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?
顺便说一句,我使用了 2 个 nib 文件:一个 Popover 和 Mainwindow.它们都不包含图像.
I'm using 2 nib files btw: One Popover and the Mainwindow. Neither of them contains an image.
出现时我发现了这一行:
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?
Menulet 是一个 NSView 子类顺便说一句.所以我正在传递一个视图.
Edit 2: The Menulet is a NSView subclass btw. So I'm passing a view.
推荐答案
就我而言,警告导致用矩形重写我的 menuIcon(正在处理 menuBar 应用程序).还没有解决这个问题,但我知道在我的情况下它来自哪里.如果您有菜单栏应用程序,请检查生成图标的代码.
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.
这篇关于“绘制图像没有意义"- 升级到 MountainLion 后的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!