gpt4 book ai didi

objective-c - "-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object"调用 selectRowIndexes :byExtendingSelection: 时

转载 作者:行者123 更新时间:2023-12-03 17:58:34 25 4
gpt4 key购买 nike

我正在尝试使用以下代码更改 NSTableView 的当前选择:

[self.modesTable selectRowIndexes:indexSet byExtendingSelection:NO];

我收到以下错误:

-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object

我根本没有使用任何字典。有人知道这可能来自哪里吗?

这是堆栈跟踪:

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
)

最佳答案

该异常肯定是由于在-[FRRMode saveObject:named:]中调用-[NSDictionary setObject:forKey:]引起的。

如果您确实在此方法中没有使用任何字典,您仍然应该查找setObject:forKey:。如果你过度释放一个对象,它的内存地址可能会被一个NSDictionary占用,而它显然不会响应选择器。

关于objective-c - "-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object"调用 selectRowIndexes :byExtendingSelection: 时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9997440/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com