gpt4 book ai didi

每次打开新窗口时 XCode 4.2.1 都会崩溃

转载 作者:行者123 更新时间:2023-12-04 20:52:17 25 4
gpt4 key购买 nike

我有用于 Lion 的 Xcode 4.2.1,每次我在新窗口中打开任何东西时它都会崩溃(例如 - 双击任何文件)。在这种情况下,类型无关紧要。它会因 .h、.m、.xib、.plist 等而崩溃......我重新安装了 Xcode 无济于事。这直到最近才发生——但一旦发生过——它就会不断发生。

它似乎与当前打开的项目没有任何关系——因为我已经关闭了所有项目并打开了一个新项目——但我仍然看到了这个问题。

更新:请参阅下面的答案,了解我是如何最终解决此问题的。

这是我得到的异常(exception):

UNCAUGHT EXCEPTION (NSUnknownKeyException): [<__NSCFConstantString 0x7fff7e9e38e0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key file://localhost/Projects/SomeProject/SomeFile.plist.
UserInfo: {
NSTargetObjectUserInfoKey = "";
NSUnknownUserInfoKey = "file://localhost/Projects/SomeProject/SomeFile.plist";
}
Hints: None
Backtrace:
0 0x00007fff979c426a __exceptionPreprocess (in CoreFoundation)
1 0x00007fff983acd5e objc_exception_throw (in libobjc.A.dylib)
2 0x00007fff97a4e4c9 -[NSException raise] (in CoreFoundation)
3 0x00007fff8f9a8783 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] (in Foundation)
4 0x00007fff8f8df462 _NSGetUsingKeyValueGetter (in Foundation)
5 0x00007fff8f8df3e9 -[NSObject(NSKeyValueCoding) valueForKey:] (in Foundation)
6 0x00007fff8f8df101 -[NSArray(NSKeyValueCoding) valueForKey:] (in Foundation)
7 0x000000010a2ced12 -[IDEWorkspaceDocument _defaultPrimaryEditorFrameSizeForDocumentURL:] (in IDEKit)
8 0x000000010a307d62 -[IDEWorkspaceWindowController _changeSizeForSimpleEditorWindowLayoutWithEditorDocumentURLOrNil:workspaceTabController:] (in IDEKit)
9 0x000000010a30827d -[IDEWorkspaceWindowController _revertForNewWindowWithTabStateContext:documentURL:simpleEditorWindowLayout:completionBlock:] (in IDEKit)
10 0x000000010a2cf795 -[IDEWorkspaceDocument _makeTabbedWindowControllerWithStateFromTabController:documentURL:simpleEditorWindowLayout:frontmost:completionBlock:] (in IDEKit)
11 0x000000010a2f4188 +[IDEEditorCoordinator _doOpenIn_NewWindow_withWorkspaceTabController:documentURL:usingBlock:] (in IDEKit)
12 0x000000010a2f4c41 +[IDEEditorCoordinator _doOpenIn_SeparateWindow_withWorkspaceTabController:documentURL:usingBlock:] (in IDEKit)
13 0x000000010a2599ba +[IDEEditorCoordinator _doOpenWithWorkspaceTabController:editorContext:target:allowFallback:documentURL:usingBlock:] (in IDEKit)
14 0x000000010a2f4dd5 +[IDEEditorCoordinator _doOpenEditorOpenSpecifier:forWorkspaceTabController:editorContext:target:takeFocus:] (in IDEKit)
15 0x000000010a259353 -[_IDEOpenRequest _runIfNecessary] (in IDEKit)
16 0x000000010a258d3a -[_IDEOpenRequest _enqueueForEventBehavior:] (in IDEKit)
17 0x000000010a258855 +[IDEEditorCoordinator _openRequestForEditorOpenSpecifier:workspaceTabController:editorContext:eventBehavior:takeFocus:] (in IDEKit)
18 0x000000010a2587ac __99+[IDEEditorCoordinator _openEditorOpenSpecifier:forWorkspaceTabController:eventBehavior:takeFocus:]_block_invoke_0 (in IDEKit)
19 0x000000010a258740 _performBlockInsideReentrantGuard (in IDEKit)
20 0x000000010a2586b5 +[IDEEditorCoordinator _openEditorOpenSpecifier:forWorkspaceTabController:eventBehavior:takeFocus:] (in IDEKit)
21 0x000000010a25839d +[IDEEditorCoordinator openEditorOpenSpecifier:forWorkspaceTabController:eventType:] (in IDEKit)
22 0x000000010a2579a1 -[IDEOutlineBasedNavigator _openNavigableItem:eventType:] (in IDEKit)
23 0x00007fff979b3a1d -[NSObject performSelector:withObject:] (in CoreFoundation)
24 0x00007fff8df32710 -[NSApplication sendAction:to:from:] (in AppKit)
25 0x0000000109b1fd10 -[DVTApplication sendAction:to:from:] (in DVTKit)
26 0x000000010a207cf4 -[IDEApplication sendAction:to:from:] (in IDEKit)
27 0x00007fff8df32642 -[NSControl sendAction:to:] (in AppKit)
28 0x000000010a25776f -[IDENavigatorOutlineView sendAction:to:] (in IDEKit)
29 0x00007fff8df98f48 -[NSTableView _sendAction:to:row:column:] (in AppKit)
30 0x00007fff8df95d0f -[NSTableView mouseDown:] (in AppKit)
31 0x00007fff8e313592 -[NSOutlineView mouseDown:] (in AppKit)
32 0x000000010a256274 -[IDENavigatorOutlineView mouseDown:] (in IDEKit)
33 0x00007fff8defb0e0 -[NSWindow sendEvent:] (in AppKit)
34 0x00007fff8de9368f -[NSApplication sendEvent:] (in AppKit)
35 0x000000010a207a11 -[IDEApplication sendEvent:] (in IDEKit)
36 0x00007fff8de29682 -[NSApplication run] (in AppKit)
37 0x00007fff8e0a880c NSApplicationMain (in AppKit)
38 0x0000000109901eec (in Xcode)
39 0x0000000000000002

最佳答案

堆栈跟踪显示 NSArray发送 valueForKey: 的对象带有 key 的消息 "file://localhost/Projects/SomeProject/SomeFile.plist" .这只是发送 valueForKey:到数组中的每个对象。其中一个对象是空 NSString它只有默认值 NSObject的实现 valueForKey: ,它自然对上述键( @"file://..." )一无所知,因此会引发异常。

发送方法valueForKey:到 NSArray 是-[IDEWorkspaceDocument _defaultPrimaryEditorFrameSizeForDocumentURL:]在 IDEKit 中。

所以我在 IDEKit (/Developer/Library/PrivateFrameworks/IDEKit.framework/Versions/A/IDEKit) 中使用 hopper disassembler 反汇编了这个方法.

我的结论是这个方法从 Xcode 的 [NSUserDefaults standardUserDefault] 读取一个 NSArray , 从 key @"IDEDefaultPrimaryEditorFrameSizeForPaths" .然后将此数组发送 valueForKey:使用您的文件路径,希望找到文件编辑器的帧大小,但却导致错误。问题可能是这个 NSUserDefaults条目变得无效(要么是带有意外内容的 NSArray ,要么甚至不应该是 NSArray )。

因此,正如@RAZ 所建议的那样,清除 Xcode 的首选项很有可能会有所帮助:-)
(不确定它会有所帮助,因为 Xcode 可以在运行时注册用户默认值 - 但它可能)。

另一种(不太有趣但实用:-))解决方案是将 Xcode 重新安装到默认位置以外的位置。安装时,您可以选择自定义安装文件夹。这将在您的原件旁边并排安装一个全新的 Xcode 副本。

关于每次打开新窗口时 XCode 4.2.1 都会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9179396/

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