Ich versuche, die aktuelle Auswahl eines NSTableView mit dem folgenden Code zu ändern:"- [__ NSCFDictionary setObject: forKey:]: Mutieren Methode unveränderliches Objekt gesendet" beim Aufruf selectRowIndexes: byExtendingSelection:
[self.modesTable selectRowIndexes:indexSet byExtendingSelection:NO];
und ich erhalte den folgenden Fehler:
-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object
Ich verwende überhaupt kein Wörterbuch. Weiß jemand, woher das kommt?
Hier ist der Stack-Trace:
2012-04-03 18:14:00.598 TurnMode[7130:403] An uncaught exception was raised
2012-04-03 18:14:00.599 TurnMode[7130:403] -[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object
2012-04-03 18:14:00.603 TurnMode[7130:403] (
0 CoreFoundation 0x00007fff8ac44fc6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff8644cd5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8ac44dfa +[NSException raise:format:arguments:] + 106
3 CoreFoundation 0x00007fff8ac44d84 +[NSException raise:format:] + 116
4 CoreFoundation 0x00007fff8ac01ec0 -[__NSCFDictionary setObject:forKey:] + 96
5 TurnMode 0x0000000100009722 -[FRRMode saveObject:named:] + 210
6 TurnMode 0x0000000100008f20 -[FRRMode saveToUserDefaults] + 192
7 TurnMode 0x000000010000701d -[FRRPreferencesController tableViewSelectionDidChange:] + 125
8 Foundation 0x00007fff877b7d32 __-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 47
9 CoreFoundation 0x00007fff8abedaaa _CFXNotificationPost + 2634
10 Foundation 0x00007fff877a3fe7 -[NSNotificationCenter postNotificationName:object:userInfo:] + 65
11 AppKit 0x00007fff8bcd51d9 -[NSTableView _sendSelectionChangedNotificationForRows:columns:] + 203
12 AppKit 0x00007fff8bcabbfe -[NSTableView _enableSelectionPostingAndPost] + 425
13 AppKit 0x00007fff8bcd4045 -[NSTableView _doSelectIndexes:byExtendingSelection:indexType:funnelThroughSingleIndexVersion:] + 2915
14 TurnMode 0x0000000100006662 -[FRRPreferencesController syncViewWithTempModel] + 914
15 TurnMode 0x0000000100006c76 -[FRRPreferencesController showPreferencesView:] + 438
16 CoreFoundation 0x00007fff8ac3475d -[NSObject performSelector:withObject:] + 61
17 AppKit 0x00007fff8bc6ecb2 -[NSApplication sendAction:to:from:] + 139
18 AppKit 0x00007fff8bd5bfe7 -[NSMenuItem _corePerformAction] + 399
19 AppKit 0x00007fff8bd5bd1e -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 125
20 AppKit 0x00007fff8bff9dd4 -[NSMenu _internalPerformActionForItemAtIndex:] + 38
21 AppKit 0x00007fff8be8a3a9 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 138
22 AppKit 0x00007fff8bcd5b4b NSSLMMenuEventHandler + 339
23 HIToolbox 0x00007fff8d6f4294 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1263
24 HIToolbox 0x00007fff8d6f38a0 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 446
25 HIToolbox 0x00007fff8d70a677 SendEventToEventTarget + 76
26 HIToolbox 0x00007fff8d7506c1 _ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef + 398
27 HIToolbox 0x00007fff8d837c59 SendMenuCommandWithContextAndModifiers + 56
28 HIToolbox 0x00007fff8d87e73d SendMenuItemSelectedEvent + 253
29 HIToolbox 0x00007fff8d7497bb _ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 101
30 HIToolbox 0x00007fff8d877175 _ZL19PopUpMenuSelectCoreP8MenuData5PointdS1_tjPK4RecttjS4_S4_PK10__CFStringPP13OpaqueMenuRefPt + 1660
31 HIToolbox 0x00007fff8d877434 _HandlePopUpMenuSelection7 + 621
32 AppKit 0x00007fff8be8d075 _NSSLMPopUpCarbonMenu3 + 3860
33 AppKit 0x00007fff8c2386b6 _NSPopUpCarbonMenu3 + 39
34 AppKit 0x00007fff8be8b1da -[NSCarbonMenuImpl popUpMenu:atLocation:width:forView:withSelectedItem:withFont:withFlags:withOptions:] + 322
35 AppKit 0x00007fff8c0eb8da +[NSStatusBarButtonCell popupStatusBarMenu:inRect:ofView:withEvent:] + 673
36 AppKit 0x00007fff8c0ebb85 -[NSStatusBarButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 147
37 AppKit 0x00007fff8bc6cbde -[NSControl mouseDown:] + 786
38 AppKit 0x00007fff8bc376e0 -[NSWindow sendEvent:] + 6306
39 AppKit 0x00007fff8c0ec598 -[NSStatusBarWindow sendEvent:] + 66
40 AppKit 0x00007fff8bbd016d -[NSApplication sendEvent:] + 5593
41 AppKit 0x00007fff8bb661f2 -[NSApplication run] + 555
42 AppKit 0x00007fff8bde4b88 NSApplicationMain + 867
43 TurnMode 0x0000000100001ab2 main + 34
44 TurnMode 0x0000000100001a84 start + 52
)
Können Sie den Stack-Trace veröffentlichen, der gedruckt wird, wenn die Ausnahme ausgelöst wird? –
Der Stack-Trace zeigt an, dass das Problem wahrscheinlich in '- [FRRMode saveToUserDefaults]' oder '- [FRRMode saveObject: name:]' auftritt. Können Sie den Code für diese Methoden veröffentlichen? Stellen Sie für Ihr eigenes Debugging sicher, dass Sie einen Ausnahmebreakpoint gesetzt haben, damit der Debugger stoppt, wenn diese Ausnahme ausgelöst wird. Klicken Sie dann auf die entsprechenden Zeilen im Stack-Trace, um genau zu ermitteln, welche Zeile in Ihrem Code den Fehler verursacht. –