Frage

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 :)

War es hilfreich?

Lösung 4

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 :)

Andere Tipps

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.

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.

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

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.

I worked as the following:

  1. Find <<<<<<< HEAD in the Journal and Conflict Resolver.
  2. Delete them all (Delete -> Revert). We can check whether the storyboard changes are resolved by manually opening the project storyboard. It will definitely throw error with line number.
  3. Stage -> Commit -> Commit All changes
  4. Pull again.
  5. Push the same.

If anything is new being added, manually share the project storyboard between people, make team member's UI changes to one storyboard and push it. Rest of the teammates must clone the project to continue.

Cloning the project:

  1. Delete the project from Documents directory(where it is saved)
  2. Open SmartGit. Select Remove from the dialogue box.
  3. Repository -> Clone -> Set Repository URL -> Continue
  4. Include modules & Submodules -> Add path of local directory -> Finish
  5. Once the project is cloned, make a pull.

Here is the solution. It helped me. It is because of multiple git pull request.

  1. Go to your storyboard source code (right click on storyboard go Open As then go Source Code)

  2. tab cmd+f and type HEAD then return.

  3. You will see multiple HEAD name starting from the line beginning. like this format.HEAD and equal and greater then signs are shown

  4. just remove the code you don't want any of selected part given in the image also remove other keyword shown.equals and greater then signs section of codeHEAD to equal signs code

  5. Also remove the HEAD, equal, greater then signs. just left any one line in between these codes.(the xml line code you want to remain)

  6. Thats it just right click the storyboard and click on interface builder view.

What I would do:

1- open the Xib file as a source code by right clicking on it --> Open As --> Source Code

2- Find the line causing the error. 3- it usually looks like this:

<<<<<<< HEAD

// code

=======

>>>>>>>

4- Go ahead and remove your code from within these lines. 5- Open the Xib file as storyboard again and insert your previous UI elements again.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top