2013-06-05 31 views
8

在幾個開發人員在我們的某個應用程序中處理故事板後,我們現在在嘗試在Xcode Interface Builder中打開故事板時發生此錯誤:無法打開故事板(com.apple.InterfaceBuilder錯誤-1。)

文檔「MainStoryboard_iPhone.storyboard」無法打開。 該操作無法完成。 (com.apple.InterfaceBuilder錯誤 -1。)

檢查控制檯日誌以獲取更多信息。

我們都運行最新版本的Xcode(4.6.2 4H1003),並且所有更改都是在Interface Builder中的故事板上進行的。控制檯日誌中沒有顯示其他信息。我假設錯誤指的是日誌和調試語句出現的同一個控制檯日誌,它完全是空的。

其中一個開發人員在嘗試在我正在處理的另一個應用程序中打開故事板時收到同樣的錯誤。這個故事板在我的電腦上可以在Xcode上正常打開,所以我們從來不打算在當時更多地查看錯誤(第一次發生在幾個月前)。但是這一次,我們都遇到了同樣的錯誤(我們中有4人已經在我們自己的電腦上打開了它)。

我們使用GitHub來管理我們的兩個項目的源代碼管理,使用幾個不同的Git客戶端。任何想法是什麼導致這個錯誤,以及如何解決它?

UPDATE:這是試圖打開的故事板後/var/logs/system.log我的電腦上輸出:

Jun 5 16:38:44 my-computer-host-name Xcode[271]: Exception raised while unarchiving document objects - *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil 
Jun 5 16:38:45 my-computer-host-name Xcode[271]: [MT] DVTAssertions: Warning in /SourceCache/IDEKit/IDEKit-2113/Framework/Classes/Editor/IDEEditorDocument.m:1364 
    Details: Message sent to invalidated IBStoryboardDocument instance <IBStoryboardDocument: 0x40ecc34c0>. Backtrace for invalidation: 
     0 0x000000010d814f86 -[IDEEditorDocument _invalidate] (in IDEKit) 
     1 0x000000010d883291 -[IDEEditorDocument initForURL:withContentsOfURL:ofType:error:] (in IDEKit) 
     2 0x00000001103005d0 -[IBDocument initForURL:withContentsOfURL:ofType:error:] (in IDEInterfaceBuilderKit) 
     3 0x000000010d882efd +[IDEDocumentController _newEditorDocumentWithClass:forURL:withContentsOfURL:ofType:extension:error:] (in IDEKit) 
     4 0x000000010d882dba -[IDEEditorContext _newEditorDocumentWithClass:forURL:withContentsOfURL:ofType:extension:error:] (in IDEKit) 
     5 0x000000010d88290c -[IDEEditorContext _openNavigableItem:withContentsOfURL:documentExtension:shouldInstallEditorBlock:] (in IDEKit) 
     6 0x000000010d991628 -[IDEEditorContext _notifyDelegateAndOpenNavigableItem:withContentsURL:documentExtensionIdentifier:locationToSelect:annotationRepresentedObject:stateDictionary:annotationWantsIndicatorAnimation:exploreAnnotationRepresentedObject:highlightSelection:] (in IDEKit) 
     7 0x000000010d8bfe7b -[IDEEditorContext _notifyDelegateAndOpenEditorOpenSpecifier:updateHistory:] (in IDEKit) 
     8 0x000000010d8bf99c -[IDEEditorContext _openEditorOpenSpecifier:updateHistory:] (in IDEKit) 
     9 0x000000010d8bf8ba -[IDEEditorContext openEditorOpenSpecifier:] (in IDEKit) 
    10 0x000000010d8cbf40 -[IDEEditorGeniusMode openEditorOpenSpecifier:editorContext:] (in IDEKit) 
    11 0x000000010d8bf76e -[IDEEditorArea _openEditorOpenSpecifier:editorContext:takeFocus:] (in IDEKit) 
    12 0x000000010d9a3174 __108+[IDEEditorCoordinator _doOpenEditorOpenSpecifier:forWorkspaceTabController:editorContext:target:takeFocus:]_block_invoke (in IDEKit) 
    13 0x000000010d8bf6cc +[IDEEditorCoordinator _doOpenWithWorkspaceTabController:editorContext:target:allowFallback:documentURL:usingBlock:] (in IDEKit) 
    14 0x000000010d8bf12d +[IDEEditorCoordinator _doOpenEditorOpenSpecifier:forWorkspaceTabController:editorContext:target:takeFocus:] (in IDEKit) 
    15 0x000000010d8bed45 -[_IDEOpenRequest _runIfNecessary] (in IDEKit) 
    16 0x00007fff8bfde395 __NSFireDelayedPerform (in Foundation) 
    17 0x00007fff8b169804 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation) 
    18 0x00007fff8b16931d __CFRunLoopDoTimer (in CoreFoundation) 
    19 0x00007fff8b14ead9 __CFRunLoopRun (in CoreFoundation) 
    20 0x00007fff8b14e0e2 CFRunLoopRunSpecific (in CoreFoundation) 
    21 0x00007fff8ac57eb4 RunCurrentEventLoopInMode (in HIToolbox) 
    22 0x00007fff8ac57c52 ReceiveNextEventCommon (in HIToolbox) 
    23 0x00007fff8ac57ae3 BlockUntilNextEventMatchingListInMode (in HIToolbox) 
    24 0x00007fff85f5d563 _DPSNextEvent (in AppKit) 
    25 0x00007fff85f5ce22 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in AppKit) 
    26 0x00007fff85f541d3 -[NSApplication run] (in AppKit) 
    27 0x00007fff85ef8c06 NSApplicationMain (in AppKit) 
    28 0x000000010cbc9b6f (in Xcode) 
    29 0x000000010cbc9b00 (in Xcode) 
    30 0x0000000000000002 

    Object: <IBStoryboardDocument: 0x40ecc34c0> 
    Method: -updateChangeCount: 
    Thread: <NSThread: 0x40030a220>{name = (null), num = 1} 
    Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide. 

而這是其他開發人員的計算機上的日誌輸出後嘗試打開,我們就在這同樣的錯誤其他項目的故事板(這是我的電腦上打開精美的故事板):

Jun 5 17:20:13 other-dev-computer-host-name Xcode[157]: Exception raised while unarchiving document objects - *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil 
Jun 5 17:20:13 other-dev-computer-host-name Xcode[157]: [MT] DVTAssertions: Warning in /SourceCache/IDEKit/IDEKit-2113/Framework/Classes/Editor/IDEEditorDocument.m:1364 
    Details: Message sent to invalidated IBStoryboardDocument instance <IBStoryboardDocument: 0x409ec3340>. Backtrace for invalidation: 
     0 0x000000010d746f86 -[IDEEditorDocument _invalidate] (in IDEKit) 
     1 0x000000010d7b5291 -[IDEEditorDocument initForURL:withContentsOfURL:ofType:error:] (in IDEKit) 
     2 0x00000001102755d0 -[IBDocument initForURL:withContentsOfURL:ofType:error:] (in IDEInterfaceBuilderKit) 
     3 0x000000010d7b4efd +[IDEDocumentController _newEditorDocumentWithClass:forURL:withContentsOfURL:ofType:extension:error:] (in IDEKit) 
     4 0x000000010d7b4dba -[IDEEditorContext _newEditorDocumentWithClass:forURL:withContentsOfURL:ofType:extension:error:] (in IDEKit) 
     5 0x000000010d7b490c -[IDEEditorContext _openNavigableItem:withContentsOfURL:documentExtension:shouldInstallEditorBlock:] (in IDEKit) 
     6 0x000000010d7d9c96 -[IDEEditorContext _openNavigableItem:withContentsOfURL:shouldInstallEditorBlock:] (in IDEKit) 
     7 0x000000010d8c3667 -[IDEEditorContext _notifyDelegateAndOpenNavigableItem:withContentsURL:documentExtensionIdentifier:locationToSelect:annotationRepresentedObject:stateDictionary:annotationWantsIndicatorAnimation:exploreAnnotationRepresentedObject:highlightSelection:] (in IDEKit) 
     8 0x000000010d7f1e7b -[IDEEditorContext _notifyDelegateAndOpenEditorOpenSpecifier:updateHistory:] (in IDEKit) 
     9 0x000000010d7f199c -[IDEEditorContext _openEditorOpenSpecifier:updateHistory:] (in IDEKit) 
    10 0x000000010d7f18ba -[IDEEditorContext openEditorOpenSpecifier:] (in IDEKit) 
    11 0x000000010d7f189f -[IDEEditorModeViewController openEditorOpenSpecifier:editorContext:] (in IDEKit) 
    12 0x000000010d7f176e -[IDEEditorArea _openEditorOpenSpecifier:editorContext:takeFocus:] (in IDEKit) 
    13 0x000000010d8d5174 __108+[IDEEditorCoordinator _doOpenEditorOpenSpecifier:forWorkspaceTabController:editorContext:target:takeFocus:]_block_invoke (in IDEKit) 
    14 0x000000010d7f16cc +[IDEEditorCoordinator _doOpenWithWorkspaceTabController:editorContext:target:allowFallback:documentURL:usingBlock:] (in IDEKit) 
    15 0x000000010d7f112d +[IDEEditorCoordinator _doOpenEditorOpenSpecifier:forWorkspaceTabController:editorContext:target:takeFocus:] (in IDEKit) 
    16 0x000000010d7f0d45 -[_IDEOpenRequest _runIfNecessary] (in IDEKit) 
    17 0x00007fff98955395 __NSFireDelayedPerform (in Foundation) 
    18 0x00007fff909bd804 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation) 
    19 0x00007fff909bd31d __CFRunLoopDoTimer (in CoreFoundation) 
    20 0x00007fff909a2ad9 __CFRunLoopRun (in CoreFoundation) 
    21 0x00007fff909a20e2 CFRunLoopRunSpecific (in CoreFoundation) 
    22 0x00007fff92e5eeb4 RunCurrentEventLoopInMode (in HIToolbox) 
    23 0x00007fff92e5ec52 ReceiveNextEventCommon (in HIToolbox) 
    24 0x00007fff92e5eae3 BlockUntilNextEventMatchingListInMode (in HIToolbox) 
    25 0x00007fff96036563 _DPSNextEvent (in AppKit) 
    26 0x00007fff96035e22 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in AppKit) 
    27 0x00007fff9602d1d3 -[NSApplication run] (in AppKit) 
    28 0x00007fff95fd1c06 NSApplicationMain (in AppKit) 
    29 0x000000010caf9b6f (in Xcode) 
    30 0x000000010caf9b00 (in Xcode) 
    31 0x0000000000000002 

Object: <IBStoryboardDocument: 0x409ec3340> 
Method: -updateChangeCount: 
Thread: <NSThread: 0x40030a1a0>{name = (null), num = 1} 
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide. 

這兩個日誌輸出是非常相似的。在第6行的第二個輸出的調用堆棧中還有一行:[IDEEditorContext _openNavigableItem:withContentsOfURL:shouldInstallEditorBlock:] (in IDEKit)。並且第11行(1日10)引用方法IDEEditorModeViewController而不是IDEEditorGeniusMode。否則,日誌輸出是相同的。

請注意,我們原來收到此錯誤的第二個故事板不會因爲Git合併衝突而出現問題,因爲我是唯一一個在此故事板上工作的開發人員。我從來不需要將提交合併到這個存儲庫,因爲我是唯一的貢獻開發人員。

+0

您可以檢出故事板的以前版本,並在同一臺計算機上使用相同的Xcode安裝成功打開它嗎? –

+0

[com.apple.InterfaceBuilder錯誤-1的可能重複。故事板不能打開](http://stackoverflow.com/questions/17495793/com-apple-interfacebuilder-error-1-storyboard-can-not-be-打開) – Laszlo

回答

5

該項目是否使用任何自定義字體?

我剛剛花了整整一天的時間處理完全相同的問題(嘗試了多臺XCode版本的多臺計算機),並在安裝了故事板能夠打開的項目中的兩個自定義字體後立即開始工作。

我收到了「無效」異常以及數組異常的混合。陣列例外引導一位開發人員到similar StackOverflow question,他意識到我們有自定義字體。

+0

這兩個項目都會使用自定義字體,是的。自從我們遇到這個錯誤以來已經有一段時間了,但如果我們再次看到它,我一定會牢記這一點。謝謝你的提示。 –

+0

我能夠確認這個問題解決了這個問題!謝謝。 –

+0

如果您沒有注意到這意味着故事板中還支持自定義字體。最後! – Kuba

2

此問題是由合併其他故事板更改引起的。故事板格式是基於XML的。當您進行更改時,這些更改將保存在項目文件中。 Xcode在保存這個文件結構的方式上似乎是非確定性的,事物的排序方式可能不同,對象可能出現在結構中的不同位置。當你獨立工作時,這並不重要,但是當兩個或兩個以上的人對故事板進行更改時,合併會變得非常難看。儘管git似乎能夠合併文件,文件的結構會被損壞,您將無法打開故事板。

提前更改故事板並推送。在更改故事板之前,Allways會拉動。不要合併,選擇一個版本並繼續。

你可能更適合將你的xcode項目文件視爲你的git倉庫中的二進制文件。請參閱http://robots.thoughtbot.com/post/33796217972/xcode-and-git-bridging-the-gap以獲取有關此方面的好消息。

至於您的情況,您可能需要簽出一個知道您的項目文件的好版本,並從那裏重建故事板中的更改。

+0

這怎麼解釋這個相同的錯誤我是在兩臺不同的計算機上打開相同的故事板時,在一臺計算機上運行,​​另一臺計算機收到錯誤消息?另外,我怎樣才能確切地看到錯誤在XML結構中的位置?我非常瞭解這個結構是如何工作的,儘管它總是令人討厭,我們盡力避免它,有時在需要拉動時合併故事板中的變化。有沒有什麼地方Interface Builder記錄更多的信息,就像它失敗的那一行? –

+1

你確定兩個計算機上的兩個項目都完全一樣嗎?此外,Xcode記錄到/var/log/system.log – Marcel

+0

是的,項目是相同的,從同一個存儲庫中取出最新的。自從我們幾個月前第一次注意到這個錯誤以來,我們已經嘗試了好幾次。每次我們希望它可能會開始使用另一個Xcode更新或其他任何東西。我一直可以自己編輯故事板。但是當其他開發者試圖在他的電腦上打開它時,他會得到同樣的錯誤。 –

-1

這爲我工作:

環境與錯誤刪除.storyboard文件(移動到回收站)。

從工作環境中複製.storyboard並將其發送到無法工作的環境(電子郵件,拇指驅動器,Skype)。

拖放.storyboard回破環境(複製和保存)

固定。

+0

^此方法有效。 –

+0

人們可能已經投下了這個修復程序,但它仍在繼續。 –

+0

這也適用於我。謝謝。 – Maxim

24

As Marcel指出:這種情況有時會發生在合併中。但是他的回答並沒有指出任何具體的東西,所以讓我提示我們必須處理幾次。在本地更改的文件合​​並後,我們有一些不可讀的故事板。

我們可以通過打開文本模式的故事板,並檢查在故事板文件的末尾每segue reference解決這些問題:

<inferredMetricsTieBreakers> 
    <segue reference="gJw-Ph-JeV"/> 
    <segue reference="Olp-GN-hLL"/> 
    <segue reference="aFq-vB-ngK"/> 
</inferredMetricsTieBreakers> 

搜索故事板爲引用的值。如果找不到該字符串的第二個匹配項,請用<!-- -->註釋掉該行。刪除所有無效的segue引用後,Xcode能夠再次打開故事板。

+0

這是我的情況。 –

+0

檢查像「DPH-X9-4b0」這樣的每一段文字都可以達到多次 – WINSergey

+0

您節省了我的一天!謝謝你的提示!這正是我發生的事情。 – mginius