[英]NSStatusItem “kCG…” Errors
由于某种原因,在控制台中
:kCGErrorIllegalArgument:CGSUnregisterWindowWithSystemStatusBar:无效的窗口
:kCGErrorFailure:设置一个断点@ CGErrorBreakpoint()以在记录错误时捕获错误。
与(我认为)此代码...
- (void)applicationDidResignActive:(NSNotification*)aNotification
{
statusItem = [[NSStatusBar systemStatusBar]
statusItemWithLength:NSVariableStatusItemLength];
[statusItem setHighlightMode:YES];
[statusItem setEnabled:YES];
//Set menubar item's tooltip
[statusItem setToolTip:@"Nucleus"];
[statusItem setMenu:theMenu];
//Set the menubar item's title
[statusItem setTitle:[NSString stringWithString:@"N"]];
[statusItem retain];
}
- (void)applicationDidBecomeActive:(NSNotification*)aNotification
{
[[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
}
我相信这是堆栈跟踪(?):
0x00007fff8667349b <+0000>推送%rbp
0x00007fff8667349c <+0001> mov%rsp,%rbp
0x00007fff8667349f <+0004> mov%edi,%eax
0x00007fff866734a1 <+0006>离开
0x00007fff866734a2 <+0007>恢复
0x00007fff866734a3 <+0008> nop
为什么? 我怎样才能解决这个问题?
我在Mac上使用可可吗?
我不确定导致错误的原因,但我确实注意到您在每次停用应用程序时都在泄漏statusItem
。 从statusBar中删除[statusItem release]
也许会有所帮助(它肯定会解决您的泄漏)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.