Couldn't open xib file after git pull, invalid element name

20,002

Solution 1

I think @Tom Harrington is right, xib file was corrupted, So

  1. I cancelled the last pull.
  2. Made the changes by my self in XIB.
  3. Take a copy from that XIB.
  4. git pull
  5. Delete the XIB in Xcode ( which was corrupted ).
  6. Added the external copy from modified XIB file.

Then every thing works great. Thanks guys :)

Solution 2

Glad you corrected the issue. I recently ran into the same issue. It a merge conflict and that is why Xcode is throwing that error. Within the .xib file you will see something like:

<<<<<<< HEAD

// code

=======

// code

>>>>>>> apps

You can do what you did above, or manually correct the merge conflict issues by opening the .xib file in a text editor. After correcting it the file should open fine in Xcode.

Solution 3

All you have to do is find the <<<<<<< HEAD lines and delete them. Compiled on my first try. For some reason they are inserted into the .xib file when you have a merge conflict.

Solution 4

Not sure if this will help anyone in the future, but you can right-click on the nib file (xib) file and open it as a source code. Search for either <<<<<<< HEAD or === or just go through it and you will be able to quickly pick what shouldn't be there. Save it, right click on it and open it as storyboard again. XCode at this point should message you that there were some inconsistencies in the file that have been taken care of. You should be able to work on it now.

i

Solution 5

When you take a pull <<<<< HEAD and <<<<< Master section is created for files that is modified locally as well as on remote. You need to decide which one to delete and make sure to mark it as conflict resolved.

Now, when it comes to XIB files this too has <<<<< HEAD and <<<<< Master in XML file. If you're confident enough to read XIB file and remove HEAD and then mark it as resolve conflicts! Otherwise discard the XIB changes and mark it as resolved! I would prefer to go with later one.

Share:
20,002
Atef
Author by

Atef

Results Oriented Software Developer with Six years experiences in Development. I make it my goal to build Software as the User will be satisfied, creating applications with a useable and intuitive user interface experience. I also Understand the importance of creating highly readable and easily maintainable source code. I am constantly striving to learn new technologies and look to ways to better my self.

Updated on May 15, 2020

Comments

  • Atef
    Atef about 4 years

    I am working on project with another developer. We are working on bitbucket.

    The problem is he made a changes in XIB files. After that when I do a git pull, I receive the changes but get an error on XIB files. When I tried to open it, a show alert message saying could not opened

    Line 81 startTag: invalid element name.

    Screenshot added

    Thanks :)