Unable to open project… cannot be opened because the project file cannot be parsed

前端 未结 21 2038
有刺的猬
有刺的猬 2020-12-04 08:34

I have been working for a while to create an iPhone app. Today when my battery was low, I was working and constantly saving my source files then the power went out...

<
相关标签:
21条回答
  • 2020-12-04 08:47

    Muhammad's answer was very helpful (and helped lead to my fix). However, simply removing the >>>>>>> ======= <<<<<<< wasn't enough to fix the parse issue in the project.pbxproj (for me) when keeping changes from both branches after a merge.

    I had a merge conflict in the PBXGroup section (whose beginning is indicated by a block comment like this: /* Begin PBXGroup section */) of the project.pbxproj file. However, the problem I encountered can occur in other places in the project.pbxproj file as well.

    Below is a simplification of the merge conflict I encountered:

        <<<<<<< HEAD
              id = {
                isa = PBXGroup;
                children = (
                     id
                );
                name = "Your Group Name";
        =======
              id = {
                isa = PBXGroup;
                children = (
                     id
                );
                name = "Your Group Name";
        >>>>>>> branch name
                sourceTree = "<group>";
              };
    

    When i removed the merge conflict markers this is what I was left with:

              id = {
                isa = PBXGroup;
                children = (
                     id
                );
                name = "Your Group Name";
              id = {
                isa = PBXGroup;
                children = (
                     id
                );
                name = "Your Group Name";
                sourceTree = "<group>";
              };
    

    Normally, removing the merge conflict markers would fix the parse issue in the project.pbxproj file and restore the workspace integrity. This time it didn't.

    Below is what I did to solve the issue:

              id = {
                isa = PBXGroup;
                children = (
                     id
                );
                name = "Your Group Name";
                sourceTree = "<group>";
              };
    
              id = {
                isa = PBXGroup;
                children = (
                     id
                );
                name = "Your Group Name";
                sourceTree = "<group>";
              };
    

    I actually had to add 2 lines at the end of the first PBXGroup.

    You can see that if I would have chosen to discard the changes from either Head or the merging branch, there wouldn't have been a parse issue! However, in my case I wanted to keep both groups I added from each branch and simply removing the merge markers wasn't enough; I had to add extra lines to the project.pbxproj file in order to maintain correct formatting.

    So, if you're running into parsing issues after you thought you'd resolved all you're merge conflicts, you might want to take a closer look at the .pbxproj and make sure there aren't any formatting problems!

    0 讨论(0)
  • 2020-12-04 08:49

    subversion will corrupt my project file after a svn up on an almost weekly basis. I'm trying to figure out why it does this right now and came across this problem.

    0 讨论(0)
  • 2020-12-04 08:52

    I had similar issue.

    Below are steps to resolve it:

    1. Navigate to folder where your projectName.xcodeproj.

    2. Right click and select 'Show Package Contents'. You will be able to see list of files with .pbxproj extension.

    3. Select project.pbxproj. Right click and open this file using 'Text Edit'.

    4. You will be able to see <<<<<< .mine , ============ and >>>>>>>>>> .r123. These are generally conflicts that arise when you take update from SVN. Delete these and save file.

    5. Now, you'll be able to open project without any error message.

    0 讨论(0)
  • 2020-12-04 08:54

    Try to find HEAD and _HEAD between the lines and delete this words in project.pbxproj. Backup this file before doing this..

    0 讨论(0)
  • 2020-12-04 08:57

    I came across this problem and my senior told me about a solution i.e:

    Right click on your projectname.xcodeproj file here projectname will be the name of your project. Now after right clicked select Show Packages Contents. After that open your projectname.pbxproj file in a text editor. Now search for the line containing <<<<<<< .mine, ======= and >>>>>>> .r. For example in my case it looked liked this

    <<<<<<< .mine
        9ADAAC6A15DCEF6A0019ACA8 .... in Resources */,
    =======
        52FD7F3D15DCEAEF009E9322 ... in Resources */,
    >>>>>>> .r269
    

    Now remove those <<<<<<< .mine, ======= and >>>>>>> .r lines so it would look like this

        9ADAAC6A15DCEF6A0019ACA8 /* BuyPriceBtn.png in Resources */,
    
        52FD7F3D15DCEAEF009E9322 /* discussionForm.zip in Resources */,
    

    Now save and open your Xcode project and build it. Everything will be fine.

    0 讨论(0)
  • 2020-12-04 08:57

    In case if you did not find in Text === or <<< or >>>> like was for me problem was really simple and fun... I change name of App in Xcode, but not change it in UnityProjectSettings before build - that was the problem...

    0 讨论(0)
提交回复
热议问题