2012-02-07 111 views
5

我有Lion的Xcode 4.2.1,每當我在新窗口中打開任何東西時(例如 - 雙擊任何文件),它都會崩潰。在這種情況下,類型並不重要。它會崩潰的.h,.m,.xib,.plist等....我已經重新安裝Xcode無濟於事。這種情況直到最近才發生 - 但一旦發生一次 - 它會一直髮生。XCode 4.2.1每次打開一個新窗口時崩潰

它似乎沒有任何與目前正在打開的項目有關 - 因爲我關閉了所有這些項目並打開了一個新項目 - 而且我仍然看到了這個問題。

更新:請參閱下面的答案,我如何終於得到了解決。

這是我收到的例外:

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 

回答

0

對我而言,答案最終是多種因素的綜合。出於某種原因,Xcode 4.2.x正在促成這個問題。我終於升級到Xcode 4.3 - 但問題仍然存在。在清除Xcode的首選項(更新後)後,問題就消失了。我在Xcode 4.2.x上多次嘗試過 - 但是即使清除首選項也不能解決問題。

我很高興有這個解決方案 - 但我不知道如何解決沒有升級到Xcode 4.3。

1

重置您的模擬器,它可以在升級後緩存錯誤的數據。

我也看到有人弄不好通過清除應用程序行爲不端的應用程序的首選項

http://hints.macworld.com/article.php?story=20001229001847541

只是先備份,你說你重新安裝,但一些安裝不重置首選項。

+0

它不會在模擬器中出現 - 它發生在Xcode中。它發生在模擬器甚至沒有運行時。 – dtuckernet 2012-02-13 16:33:36

0

我一直在Xcode自己也有類似的問題,我看到一些體驗與Xcode本身有關的錯誤的論壇。它可能有助於修復磁盤權限,但我無法真正確認它。但值得嘗試

2

堆棧跟蹤示出了發送的消息valueForKey:與鍵"file://localhost/Projects/SomeProject/SomeFile.plist"一個NSArray對象。這只是將valueForKey:發送到數組中的每個對象。其中一個對象是一個空的NSString,它的默認NSObject的實現爲valueForKey:,它自然不知道關於上述密鑰的任何內容(@"file://..."),所以它會引發異常。

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

因此,我使用hopper disassembler在IDEKit(/Developer/Library/PrivateFrameworks/IDEKit.framework/Versions/A/IDEKit)中反彙編了此方法。

我的結論是這個方法從Xcode的[NSUserDefaults standardUserDefault]中讀取一個NSArray,從@"IDEDefaultPrimaryEditorFrameSizeForPaths"的密鑰中讀取。這個數組然後發送valueForKey:與您的文件的路徑,希望找到文件的編輯器的幀大小,而是導致錯誤。問題可能是這個NSUserDefaults條目變得無效(它可能是一個NSArray帶有意外的內容,或者它甚至不應該是NSArray)。 (由於用戶的默認設置可以在運行時被Xcode註冊 - 但它可能會),因此,清除Xcode的首選項將會有所幫助,正如@RAZ建議的那樣:-) (這並不確定會有幫助。

一個替代方案(不太有趣但實用:-))的解決方案是將Xcode重新安裝到默認位置以外的位置。安裝時,您可以選擇一個自定義安裝文件夾。這將在您的原始文件旁邊並排安裝Xcode的全新副本。

+0

不幸的是清除所有的首選項沒有奏效。我將盡快嘗試新的安裝。 – dtuckernet 2012-02-15 13:59:00

+0

嘗試從終端:'defaults delete com.apple.dt.Xcode'。確保首先退出Xcode。 – Danra 2012-02-15 16:14:52

+0

我之前曾嘗試過 - 並沒有解決問題。 – dtuckernet 2012-02-15 18:14:56

0

只是在黑暗中拍攝,是否發生在新的用戶帳戶?

0

這裏是我固定的礦:

  • 轉到 - >首頁 - >自動保存信息 - >所有Xcode的相關文件發送至 垃圾
  • 查找 - >清空回收站
  • 蘋果 - >重啓