14

I am getting a strange error whenever I try to view a particular storyboard of a project in Xcode. When I click the storyboard in the file directory I get an alert that reads "Interface Builder was unable to determine the type of "Main.storyboard". This may be due to a missing SDK."

This only happens with this particular storyboard, I tried creating another storyboard and I was able to view it just fine. I tried reverting back to a previous version of the project when I was able to open the storyboard, but oddly enough this doesn't fix the error and I get the same alert. I also tried opening the project in an earlier version of Xcode, but to no avail.

If it provides more context, I get an error for the storyboard I get when I try to build the project that reads "The operation couldn’t be completed. (com.apple.InterfaceBuilder error 2001.)"

Any ideas on what causes this or how to fix it?

5
  • 1
    That storyboard is corrupted.
    – Johnykutty
    Jan 8, 2016 at 8:00
  • I see. Any way to fix it?
    – metalek
    Jan 8, 2016 at 8:05
  • Which version of Xcode you are using and which version of Xcode that storyboard created/last modified?
    – Johnykutty
    Jan 8, 2016 at 8:09
  • can you upload that storyboard somewhere so we can see the error?
    – Adam
    Jan 8, 2016 at 10:58
  • Sure, here it is: dropbox.com/s/qq9c4ljhfica923/Main.storyboard?dl=0
    – metalek
    Jan 8, 2016 at 17:58

8 Answers 8

21

I had the same exact issue. I would not delete it, instead I used grep to locate the file in my project directory i.e. '$grep -r "Main.storyboard" .'

Once you find it, you can use an editor (vim or perhaps emacs) to view the actual file, since it may either be corrupted, but in my case I was merging in a branch that appended to the file during automerge:

    <<<<<<< HEAD 
    document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="gHi-tD-tmJ"
    =======
    document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"
    >>>>>>> develop

If you happened to have this same issue as I did, just delete either the head or the tail of this - whichever you don't want. If you have issues with resolving conflicts, refer here:

https://githowto.com/resolving_conflicts

or

https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line/

9

This is less complex than you think.

The error is because you mistype something on the source code of Main.storyboard, for example I accidentally put an "ƒ" before the first open tag of Main.storyboard.

1) What you must do is to delete Main.storyboard (select throw to Trash)

2) Go to Trash, move the Main.storyboard to desktop, open with any text editor and fix the code; then "select all" and "copy".

3) On Xcode, create a brand new Main.storyboard and then press Right click on file and select Open As -> Source code, then paste the fixed code that you have on your clipboard.

4) Right-click on file and select Open As -> "Interface Builder - Storyboard".

Hope it works for you.

0

I got this error because I copied and pasted the xml format directly into the xib file. This resulted in unknown file endings. Once I converted to UNIX line endings the solution compiled without the error.

0

If you have resolved conflicts and still have this issue, close XCode and reopen your project. This helped me.

0

For those of you who this technique did not work for, try this and see what happens. Worth a college try.

Try changing the toolsVersion entry value towards the top of the code in storyboard code editor view. Then navigate to a different file and then back again. See if that resets the storyboard.

0

You just have to change whatever is wrong with the file Main.storyboard, in my case I don't know why after some requirements when I was working in vscode add an "X" at the beginning of the project.

0

In my case the reference of the file was pointing the same(but corrupted file) in another folder. I deleted the reference and added the file from correct location.

-1
  1. Discard file from woking copy if you have.
  2. and apply the stash.
  3. Resolve conflict and run again.

I hope it will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.