-->

com.apple.InterfaceBuilder error -1. Storyboard Ca

2019-02-27 13:11发布

问题:

I've run into a slight complication with a project and need some assistance.

I recently purchased a Mac Mini and wish to begin working on some of my app projects from it. So I copied my files from one machine to the next. Both computers are running XCode Version 4.6.3. Of the 5 projects copied, 4 of them came over just fine. However, the 5th (and naturally the one I wished to work on) cannot open the Storyboard file. I receive the following error when I click on the Storyboard file within my project:

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

Check the console log for additional information.

I am aware of another thread located here: Cannot open storyboard (com.apple.InterfaceBuilder error -1.) that attempts to deal with this issue however I have a slightly different set of variables. I am the only developer that has worked on my projects. I have never attempted to copy or move my apps from folder locations until this copy attempt to a different machine. Also a while back on the project, I remember I accidentally deleted the Storyboard file and had to dig it out of the trash and reinsert it into the project. Not sure if this is what is causing my current problem or not but figured it was worth a mention.

So my questions is thus; does anyone know what is causing this Storyboard error and how I can go about fixing it so that I may work on my projects on other computers?

Thanks for any recommendations!

回答1:

This error can occur, when an additional but not installed font is used. Install this font and open the storyboard again.



回答2:

If the error was after a git merge, then i suggest you to clean the inferredMetricsTieBreakers at your Storyboards bottom.

  1. Open Storyboard as Source Code (what else could you do?)
  2. find inferredMetricsTieBreakers block
  3. remove all <segue reference=""/>
  4. Open Storyboard as Interface Builder - Storyboard
  5. Profit!


回答3:

I would hazard a guess that the location that the project file is using is likely not the same as the one you copied over. This can happen easily if you pull in a file from outside your project directories. A quick manual reconnection can be done like so:

  1. Find the file in the Project Navigator. Right-click it (or the equivalent) and select Delete. In the pop-up that appears, select Remove Reference.
  2. Still in Project Navigator, right-click on the folder that that file was formerly listed under and choose Add Files To "Your Project Name". Track down the location of the file and Add it. It should appear in the Project Navigator again.


回答4:

I don't know how my experience relates to yours, but I had the same issue and was finally able to resolve it by removing an activity indicator view via the storyboard's XML. Specifically, the code I removed was this:

<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750” verticalHuggingPriority="750" hidesWhenStopped="YES" style="gray" id="XNx-FL-WkR">
    <rect key="frame" x="15" y="80" width="20" height="20"/>
    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</activityIndicatorView>

When I removed these lines of XML and switched back to the Interface Builder view, XCode removed an outlet the indicator was connected to (just one line).

Hope that helps someone! I'll update my answer if I find an explanation for why this fixed the problem for me.