NSWindow和Webview:应用程序崩溃“无法识别的选择器发送到实例0x100514e90”

时间:2011-10-22 17:43:55

标签: objective-c webview nswindow

我在NSWindow中有一个WebView,当我关闭窗口并再次打开它时,应用程序崩溃;(

窗口由菜单项按钮调用。

这是输出:

2011-10-22 15:55:32.440 Textis[17176:903] -[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90 
2011-10-22 15:55:32.544 Textis[17176:903] HIToolbox: ignoring exception '-[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90' that raised inside Carbon event dispatch 
( 
    0 CoreFoundation 0x00007fff838b17b4 __exceptionPreprocess + 180 
    1 libobjc.A.dylib 0x00007fff8127af03 objc_exception_throw + 45 
    2 CoreFoundation 0x00007fff8390b110 +[NSObject(NSObject) doesNotRecognizeSelector:] + 0 
    3 CoreFoundation 0x00007fff8388391f ___forwarding___ + 751 
    4 CoreFoundation 0x00007fff8387fa68 _CF_forwarding_prep_0 + 232 
    5 Textis 0x0000000100003722 -[Share tweet:] + 210 
    6 AppKit 0x00007fff84b3eeda -[NSApplication sendAction:to:from:] + 95 
    7 AppKit 0x00007fff84b6346a -[NSMenuItem _corePerformAction] + 365 
    8 AppKit 0x00007fff84b631d4 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 121 
    9 AppKit 0x00007fff84de8cf4 -[NSMenu _internalPerformActionForItemAtIndex:] + 35 
    10 AppKit 0x00007fff84c9a9e9 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 136 
    11 AppKit 0x00007fff84b4599c NSSLMMenuEventHandler + 321 
    12 HIToolbox 0x00007fff8665d7f7 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1002 
    13 HIToolbox 0x00007fff8665cd46 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 395 
    14 HIToolbox 0x00007fff8667aa81 SendEventToEventTarget + 45 
    15 HIToolbox 0x00007fff866a9c35 _ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef + 387 
    16 HIToolbox 0x00007fff866d6a0a SendMenuCommandWithContextAndModifiers + 56 
    17 HIToolbox 0x00007fff866d69c2 SendMenuItemSelectedEvent + 101 
    18 HIToolbox 0x00007fff866d68d2 _ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 150 
    19 HIToolbox 0x00007fff867dfa69 _ZL19PopUpMenuSelectCoreP8MenuData5PointdS1_tjPK4RecttjS4_S4_PK10__CFStringPP13OpaqueMenuRefPt + 1618 
    20 HIToolbox 0x00007fff867dfdc2 _HandlePopUpMenuSelection7 + 665 
    21 AppKit 0x00007fff84c9799b _NSSLMPopUpCarbonMenu3 + 3720 
    22 AppKit 0x00007fff84ec76f9 -[NSStatusBarButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 162 
    23 AppKit 0x00007fff84bc92f5 -[NSControl mouseDown:] + 624 
    24 AppKit 0x00007fff84ae33a7 -[NSWindow sendEvent:] + 5409 
    25 AppKit 0x00007fff84ec8498 -[NSStatusBarWindow sendEvent:] + 68 
    26 AppKit 0x00007fff84a18afa -[NSApplication sendEvent:] + 4719 
    27 AppKit 0x00007fff849af6de -[NSApplication run] + 474 
    28 AppKit 0x00007fff849a83b0 NSApplicationMain + 364 
    29 Textis 0x00000001000010c2 main + 34 
    30 Textis 0x0000000100001094 start + 52 
    31 ??? 0x0000000000000001 0x0 + 1 
) 

1 个答案:

答案 0 :(得分:1)

mainFrame是WebView上的一种方法

所以

2011-10-22 15:55:32.544 Textis[17176:903] HIToolbox: ignoring exception '-[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90' that raised inside Carbon event dispatch

指向窗口关闭时由OS显式或隐式释放的WebView。你正在砸死指针。

不确定如何设置窗口,但您可能认为原始WebView在重新打开时仍然是有效对象。

看看那个方向。