Cannot open storyboard (com.apple.InterfaceBuilder error -1.)
Asked Answered
L

4

10

After several developers were working on the storyboard in one of our apps, we are now getting this error when trying to open the storyboard in Xcode Interface Builder:

The document "MainStoryboard_iPhone.storyboard" could not be opened. The operation couldn’t be completed. (com.apple.InterfaceBuilder error -1.)

Check the console log for additional information.

We are all running the latest version of Xcode (4.6.2 4H1003) and all changes were made to the storyboard in Interface Builder. There is no additional information showing in the console log. I'm assuming the error is referring to the same console log where log and debug statements appear, which is completely empty.

One of the developers receives this same error when trying to open the storyboard in another of our apps I was working on. This storyboard opens fine for me in Xcode on my computer however, so we never bothered to look into the error more at the time (this first occurred a few months ago). But this time, we all get the same error (4 of us have tested opening it on our own computers).

We are using GitHub to manage our source control on both projects, using a few different Git clients. Any ideas as to what is causing this error and how to fix it?

UPDATE: This is the output to /var/logs/system.log on my computer after trying to open the storyboard:

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.

And this is the log output on the other dev's computer after trying to open the storyboard in the other project that we get this same error on (this is the storyboard that opens fine on my computer):

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.

Both log outputs are very similar. There is an additional line in the call stack of the 2nd output at line 6: [IDEEditorContext _openNavigableItem:withContentsOfURL:shouldInstallEditorBlock:] (in IDEKit). And line 11 (10 on the 1st) references the method IDEEditorModeViewController instead of IDEEditorGeniusMode. Otherwise the log outputs are identical.

Note, this 2nd storyboard that we originally received this error on would not have had a problem with Git merge conflicts as I am the only developer to have worked on this storyboard. I've never needed to merge commits to this repository at all as I'm the sole contributing developer on it.

Liggett answered 5/6, 2013 at 7:59 Comment(2)
Can you check out the prior version of the storyboard and open it successfully with the same Xcode installation on the same computers?Nathanaelnathanial
possible duplicate of com.apple.InterfaceBuilder error -1. Storyboard Can Not Be OpenedNoles
R
6

Is the project using any custom fonts?

I just spent all day long dealing with the exact same issue (tried multiple computers with multiple XCode versions), and immediately after I installed the two custom fonts we had in the project the Storyboards were able to open.

I received a mix of both the "invalidate" exception as well as an array exception. And the array exception led a fellow developer to a similar StackOverflow question where he realized we had custom fonts.

Rosenberry answered 16/8, 2013 at 22:0 Comment(3)
Both these projects would be using custom fonts, yes. It's been a while since we've had this error, but if we see it again, I'll be sure to keep this in mind. Thanks for the tip.Liggett
I was able to confirm this fixes the issue! Thanks.Liggett
If you didn't notice this mean also custom fonts support in storyboard. Finally!Houphouetboigny
F
41

As Marcel states: this sometimes occurs on a merge. But his answer does not point to anything specific, so let me give a hint what we had to deal with a few times. We had some unreadable storyboards after a merge on a file that was changed locally.

We could fix them by opening the storyboard in text-mode and checking every segue reference in the end of the storyboard file:

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

Search the storyboard for the quoted values. If you cannot find a second match for this string, comment out this line with <!-- -->. After removing all invalid segue references, Xcode was able to open the storyboards again.

Franglais answered 20/7, 2015 at 7:30 Comment(3)
this was the issue in my case.Breviary
check that every text piece like "DPH-X9-4b0" can be reach more than onceSungkiang
You saved my day! Thank you for your hint! It's exactly what happened to me.Herzl
R
6

Is the project using any custom fonts?

I just spent all day long dealing with the exact same issue (tried multiple computers with multiple XCode versions), and immediately after I installed the two custom fonts we had in the project the Storyboards were able to open.

I received a mix of both the "invalidate" exception as well as an array exception. And the array exception led a fellow developer to a similar StackOverflow question where he realized we had custom fonts.

Rosenberry answered 16/8, 2013 at 22:0 Comment(3)
Both these projects would be using custom fonts, yes. It's been a while since we've had this error, but if we see it again, I'll be sure to keep this in mind. Thanks for the tip.Liggett
I was able to confirm this fixes the issue! Thanks.Liggett
If you didn't notice this mean also custom fonts support in storyboard. Finally!Houphouetboigny
P
2

This problem is being caused by merging each others storyboard changes. The storyboard format is XML based. When you make changes, these changes are being saved in the project file. Xcode seems to be non-deterministic in the way it saves the structure of this file, things can be sorted differently, objects can appear in different places in the structure. This doesn't matter when you are working on your own, but when two or more people make a change to the storyboard, merges can get very ugly. Even though git seems to be able to merge the files fine, the structure of the file gets corrupted and you won't be able to open your storyboards.

Commit your changes to storyboards early and push. Allways pull before making changes to the storyboard. Don't merge, pick one version and continue.

You are probably better off treating your xcode project files as binary files in your git repository. See http://robots.thoughtbot.com/post/33796217972/xcode-and-git-bridging-the-gap for a good reading on this.

As for your situation, you probably have to checkout a know good version of your project file and rebuild your changes in the storyboard from there.

Popliteal answered 5/6, 2013 at 13:38 Comment(5)
How can this explain this same error I'm getting when opening the same storyboard on two different computers, on one it works, the other receives the error? Also, how can I see exactly where in the XML structure the error is being thrown? I'm knowledgeable on how this structure works and while it's always annoying and we do our best to avoid it, sometimes merging changes in storyboards when pulling is required. Is there somewhere Interface Builder logs more info, like the line it's failing on?Liggett
Are you sure both projects are exactly the same on both computers? Also, Xcode logs to /var/log/system.logPopliteal
Yes, the projects are identical, pulled the latest from the same repository. We've tried it several times since we first noticed the error a few months ago. Each time we hoped maybe it would start working with another Xcode update or anything. I've continued to be able to edit the storyboard myself. But when the other developer tries to open it on his computer, he gets the same error.Liggett
Thanks for your help. I have updated my question with the log output we are receiving.Liggett
Hmm, as the projects are identical, maybe start excluding other variables that are user-bound that could be causing this problem. You could try (one by one) trashing your user preferences, removing the *.xcuserdatad dir in the xcode project and clearing your derived data. Also check in your .gitignore file if there might be any other files that are different between your computer and your colleague's.Popliteal
P
-1

This worked for me:

in environment with error delete .storyboard file (move to trash).

copy .storyboard from environment that works and send it (solo file) to the environment that does not work (email, thumb drive, Skype, however).

drag and drop the .storyboard back into the broken environment (copy and save)

fixed.

Pacifica answered 26/1, 2015 at 17:38 Comment(1)
people may have down voted this fix, but it continues to work.Pacifica

© 2022 - 2024 — McMap. All rights reserved.