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

每次打开新窗口时,XCode 4.2.1都会崩溃,xcode,Xcode,我有针对Lion的Xcode 4.2.1,每当我在新窗口中打开任何东西(例如双击任何文件)时,它都会崩溃。在这种情况下,类型并不重要。它将崩溃.h、.m、.xib、.plist等。。。。我重新安装了Xcode,但没有用。这种情况直到最近才发生,但一旦发生过一次,它就会继续发生 它似乎与当前打开的项目没有任何关系——因为我已经关闭了所有这些项目并打开了一个新项目——我仍然看到了这个问题 更新:查看下面我的答案,了解我最终是如何解决这个问题的 以下是我得到的一个例外: UNCAUGHT EXCEPT

我有针对Lion的Xcode 4.2.1,每当我在新窗口中打开任何东西(例如双击任何文件)时,它都会崩溃。在这种情况下,类型并不重要。它将崩溃.h、.m、.xib、.plist等。。。。我重新安装了Xcode,但没有用。这种情况直到最近才发生,但一旦发生过一次,它就会继续发生

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

更新:查看下面我的答案,了解我最终是如何解决这个问题的

以下是我得到的一个例外:

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
UNCAUGHT异常(NSUnknownKeyException):[valueForUndefinedKey:]:此类与密钥的键值编码不兼容file://localhost/Projects/SomeProject/SomeFile.plist.
用户信息:{
NSTargetObjectUserInfoKey=“”;
NSUnknownUserInfoKey=”file://localhost/Projects/SomeProject/SomeFile.plist";
}
提示:无
回溯:
0 0x00007fff979c426a异常预处理(在CoreFoundation中)
1 0x00007fff983acd5e objc_异常_抛出(在libobjc.A.dylib中)
2 0x00007fff97a4e4c9-[N异常提升](在CoreFoundation中)
3 0x00007fff8f9a8783-[NSObject(NSKeyValueCoding)未定义键的值:](在基础中)
4 0x00007FFF8DF462\u NSGetUsingKeyValueGetter(基础中)
5 0x00007fff8f8df3e9-[NSObject(NSKeyValueCoding)valueForKey:(基础中)
6 0x00007fff8f8df101-[NSArray(NSKeyValueCoding)valueForKey:(基础中)
7 0x000000010a2ced12-[IDEWorkspaceDocument\u defaultPrimaryEditorFrameSizeForDocumentURL:(在IDEKit中)
8 0x000000010a307d62-[IDEWorkspaceWindowController\u更改带有EditorDocumentUrlOrnil:workspaceTabController:]的完整EditorWindowLayout的大小(在IDEKit中)
9 0x000000010a30827d-[IDEWorkspaceWindowController\u revertForNewWindowWithTabStateContext:documentURL:SimpleDirectorWindowLayout:completionBlock:(在IDEKit中)
10 0x000000010a2cf795-[IDEWorkspaceDocument\u makeTabbedWindowControllerWithStateFromTabController:documentURL:simpleEditorWindowLayout:frontmost:completionBlock:(在IDEKit中)
11 0x000000010a2f4188+[IDEEDITOR协调器使用工作空间选项卡控制器打开新窗口:文档URL:usingBlock:](在IDEKit中)
12 0x000000010a2f4c41+[IDEEDITOR协调器与工作空间选项卡控制器分开使用:文档URL:usingBlock:](在IDEKit中)
13 0x000000010a2599ba+[IDEEditorCoordinator\u doOpenWithWorkspaceTabController:editorContext:target:allowFallback:documentURL:usingBlock:(在IDEKit中)
14 0x000000010a2f4dd5+[ideditor协调器_dooteditor开放说明符:ForWorkspaceTab控制器:editorContext:target:takeFocus:(在IDEKit中)
15 0x000000010a259353-[\u IDEOpenRequest\u RUNIFESSED](在IDEKit中)
16 0x000000010a258d3a-[\u IDEOpenRequest\u ENQUEEFOREVENTBEHAVIOR:](在IDEKit中)
17 0x000000010a258855+[IDEEditorCoordinator\u openRequestForEditorOpenSpecifier:workspaceTabController:editorContext:eventBehavior:takeFocus:(在IDEKit中)
18 0x000000010a2587ac\uuuu99+[IDEditorCoordinator\uOpenEditorOpenSpecifier:forWorkspaceTabController:eventBehavior:takeFocus:][uBlock\uInvoke\u0(在IDEKit中)
19 0x000000010a258740 _性能锁内置入口防护装置(在IDEKit中)
20 0x000000010a2586b5+[IDEEditorCoordinator\u openEditorOpenSpecifier:forWorkspaceTabController:eventBehavior:takeFocus:(在IDEKit中)
21 0x000000010a25839d+[IDEEditorCoordinator openEditorOpenSpecifier:forWorkspaceTabController:eventType:(在IDEKit中)
22 0x000000010a2579a1-[IDEOutlineBasedNavigator\u openNavigableItem:eventType:(在IDEKit中)
23 0x00007fff979b3a1d-[NSObject性能选择器:withObject:](在CoreFoundation中)
24 0x00007fff8df32710-[NSApplication sendAction:to:from:](在AppKit中)
25 0x0000000109b1fd10-[DVTApplication sendAction:to:from:](在DVTKit中)
26 0x000000010a207cf4-[IDEApplication sendAction:to:from:](在IDEKit中)
27 0x00007fff8df32642-[NSControl sendAction:to:](在AppKit中)
28 0x000000010a25776f-[IDENavigatorOutlineView发送操作:至:](在IDEKit中)
29 0x00007fff8df98f48-[NSTableView\u sendAction:to:row:column:](在AppKit中)
30 0x00007fff8df95d0f-[NSTableView鼠标向下:](在应用工具包中)
31 0x00007fff8e313592-[NSOutlineView mouseDown:](在AppKit中)
32 0x000000010a256274-[IDENavigatorOutlineView鼠标向下:](在IDEKit中)
33 0x00007fff8defb0e0-[NSWindow sendEvent:](在AppKit中)
34 0x00007fff8de9368f-[N应用程序发送事件:](在应用程序工具包中)
35 0x000000010a207a11-[IDEApplication sendEvent:](在IDEKit中)
36 0x00007fff8de29682-[应用程序运行](在应用程序工具包中)
37 0x00007fff8e0a880c应用程序主程序(在应用程序套件中)
38 0x0000000109901eec(在Xcode中)
39 0x0000000000000002

重置模拟器,它可以在升级后缓存坏数据

我还看到人们通过清除应用程序优先项来修复行为不端的应用程序


先备份,你说你重新安装了,但有些安装程序没有重置prefs。

我自己在Xcode中也遇到过类似的问题,我在论坛上看到一些ppl遇到了与Xcode本身相关的错误。这可能有助于修复磁盘权限,但我无法确认。但是值得一试

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

valueForKey:
发送到NSArray的方法是
-[IDEWorkspaceDocument\u defaultPrimaryEditorFrameSizeForDocumentURL:
在IDEKit中

所以我在IDEKit(/Developer/Library/privateframes/IDEKit.framework/Versions/A/IDEKit)中反汇编了这个方法