anyName
anyName

Reputation: 113

The document "Main.storyboard" could not be be opened

I'm using Git and we are 2 people coding together. I pulled my friend's code, run it and it worked as it should be. Then I merged our parts and cleaned conflicts (almost all of them were in storyboard). Since i'm doing this merge process for a while, i'm not all stranger for these details. However, when i run the merged version of code, i get the error:

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

I can't open storyboard as interface builder either. When i try it, I get the same error. I read previous post about this error but as I mentioned, I can open and run both versions of code in my XCode before merge. Thus, there is not a font or attributed string problem.

What may be the problem?

Upvotes: 3

Views: 13102

Answers (9)

Dambar Bista
Dambar Bista

Reputation: 1

i would suggest , right click on any of the files and click on finder then you will have what you need and drag and drop

Upvotes: 0

Mussa Charles
Mussa Charles

Reputation: 4412

Fast way to fix

  1. Copy the storyboard Id shown on the error prompt window
  2. Right click on your storyboard
  3. Choose Open as => Source Code
  4. Search the id and delete one of the duplicateID and you are done!

Upvotes: 0

robfitzgerald
robfitzgerald

Reputation: 11

I had to create a new Storyboard file. Then cut and paste the "scenes" tags from the old and put into the new. I then had to delete the old Storyboard from the project in order for the project to build successfully!

Upvotes: 1

aircraft
aircraft

Reputation: 26886

I got this issue, after I solve the conflicts which is merged by svn.

I could only see the source code of my storyboard, I could not open my storyboard as interface builder. So, after my struggle,

1)I delete the topside space line in my storyboard source code

2)and close my Xcode and simulator

3)restart my project

it becomes regular, oops, the space line on the source code will affect our storyboard

Upvotes: 5

Shaked Sayag
Shaked Sayag

Reputation: 5792

For me the only thing that worked was to create a new storyboard file, open the old and the new storyboards as source code, and copy the xml from the old to the new storyboard. I didn't take the whole xml, just the scope of the <scenes> </scenes>

Upvotes: 1

Nicolas Miari
Nicolas Miari

Reputation: 16246

As other mentioned, there are likely merge conflicts in the storyboard file.

If you can't easily solve the conflict by either picking --ours or --theirs, you will have to perform the merge manually in the storyboard file.

What I do is open in in a text editor (e.g., TextEdit.app - but make sure it opens documents as plain text, in Preferences).

Then, locate any occurrence of the git conflict markers (or a portion thereof, e.g., "<<<<<"), and pick the code fragment that you want to leave (and remove the other, of course).


EDIT: As Cong Tran mentioned (and I forgot), you can open storyboards as source code from within Xcode itself (see his answer).

Upvotes: 0

Cong Tran
Cong Tran

Reputation: 1458

I guess your storyboard still have confliction.View your storyborad as source code, then fix all conflictions. After all, open it again as Interface builder

Example

Upvotes: 2

vaibby
vaibby

Reputation: 1265

there are conflicts in Storyboard. You can take last working code of storyboard from github. select storyboard select version editor and copy last working storyboard and replace xml with existing xml.

Upvotes: 2

Mikhail Glotov
Mikhail Glotov

Reputation: 376

I guess the problem is that storyboards don't merge very well, I think it is better to init your UI from code so there will be no troubles during merges. Anyway you should try to rollback and merge it again.

Upvotes: 0

Related Questions