15

I always solved this problem by using directory structure of the other members shall prevail ,and then confirm don't have any conflicts and mend it to what directory structure I want.

So, I want to know, the project.pbxproj file have conflicts, how to solve it through other best way?

David 'mArm' Ansermot
  • 5,839
  • 6
  • 44
  • 80
iforvert
  • 170
  • 1
  • 2
  • 10
  • 1
    No easy answer to that, however it will be difficult to solve, given the file is not designed to be human readable (it's perfectly editable, sure, but it doesn't make much sense, using UUIDs to link between sections). – trojanfoe May 24 '16 at 08:21
  • 1
    http://stackoverflow.com/questions/2004135/how-to-merge-conflicts-file-project-pbxproj-in-xcode-use-svn – Asim K T May 24 '16 at 09:56
  • @AsimKT 's question is about SVN but there's a great answer for Git among the answers: http://stackoverflow.com/a/2007358/2003763 – Thibault D. May 24 '16 at 10:11
  • I usually edit the file by hand. It's trivial in most cases. If you fail you can always cancel your merge and retry. I also tried using external merge tools like p4merge but if these tools are very efficient for code files, they sometimes make it worse when it comes to `pbxproj` files. – Thibault D. May 24 '16 at 10:13
  • I noticed that, and found the git related answer, that's why I commented it. – Asim K T May 24 '16 at 10:19
  • 1
    @ThibaultD's answer is what I wanted. Thanks a lot.http://stackoverflow.com/questions/2004135/how-to-merge-conflicts-file-project-pbxproj-in-xcode-use-svn/2007358#2007358 – iforvert May 27 '16 at 06:31
  • The best tool to solve conflicts there is Kdiff3. Give a try. – fjtrujy Jun 01 '17 at 14:32

1 Answers1

29

Normally, you simply want to accept both sides of the merge (people added different files) and that's all.

After that, if your file is still 'corrupted', in most cases the problem is due to a wrong format after merge, most common scenarios are:

  • missing a comma
  • duplicated statements

It's very easy to fix if you know what you are looking.

You can use a syntax checker to verify the project.pbxproj file, I use Kin and it works like a charm. It will parse your project configuration file and detect errors.


For Example (Using KIN)

If your project file gets corrupted you can be left with something like this:

enter image description here

And if your diffs on the file are far too much.. it can be quite challenging to find the error...now, after using KIN you can go from problem to solution in no time.

enter image description here

Hugo Alonso
  • 6,394
  • 2
  • 29
  • 64
Ana Llera
  • 1,316
  • 16
  • 32