簡體   English   中英

NSStatusItem“ kCG…”錯誤

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM