Unable to open project... cannot be opened because the project file cannot be parsed
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.
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!
I got this exact same error because Cordova will allow you to create a project with spaces in it, and Xcode doesn't know how to deal.
I had similar issue.
Below are steps to resolve it:
-
Navigate to folder where your
projectName.xcodeproj
. -
Right click and select '
Show Package Contents
'. You will be able to see list of files with.pbxproj
extension. -
Select
project.pbxproj
. Right click and open this file using 'Text Edit
'. -
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. Now, you'll be able to open project without any error message.