Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why my project.pbxproj file changes its format

Tags:

xcode

ios

xunique

project.pbxproj is like json.But since I use the latest Xcode(7.3.1),it changes to plist.Here is my project.pbxproj:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>archiveVersion</key>
    <string>1</string>
    <key>classes</key>
    <dict/>
    <key>objectVersion</key>
    <string>46</string>
    <key>objects</key>
    <dict>
        <key>0047E8048E5EE8D208C0B009261D5816</key>
        <dict>
            <key>fileRef</key>
            <string>A1C5C2AA97A78115584DFC22517232F2</string>
            <key>isa</key>
            <string>PBXBuildFile</string>
        </dict>
        <key>008246B8B3F0ED1F2BCDAC8B0BF9CB2F</key>

The problem is I can't commit my project.And I get this error:

File 'project.pbxproj' is broken. Cannot find PBXProject name.

I'm using Xunique to avoid conflicts,maybe this will help.Please tell me how to deal with this.Many thanks!

like image 668
Lumialxk Avatar asked May 07 '16 01:05

Lumialxk


People also ask

What is Project Pbxproj file?

Data file created by Xcode, a development application for Mac OS X; saves project data such as the list of source code and resource files and the build properties; also saves the Group data, which organizes the resource files in a virtual folder hierarchy.


1 Answers

@Lumialxk

I had a very similar thing occur yesterday. Similar in that my project.pbxproj file was in plist format, different in that I did not get a File 'project.pbxproj' is broken message. Instead, the issue surfaced for me via a merge conflict. Where the conflict was in the project.pbxproj file. There was one conflict and it was the entire contents of the file. In other words there were two versions of the file. One on my new branch where it was in plist format. And one on our base branch where it was in the normal JSON-like format. Either way, it sounds like the same thing you are seeing.

Important to note that both branches pre-merge worked with Xcode. Xcode didn't seem to have an issue with the plist formatted project.pbxproj file.

I solved the issue by doing a git reset --hard HEAD to throw away my attempted merge, this got me back to a point where I had a branch with a plist project.pbxproj file that I could build and run without issue. I then chose a random build setting (code signing), changed its value and then changed it back (i.e. I just "touched" it to force Xcode to modify it). I then built the project. And then re-opened the project.pbxproj file in a text editor. After having "touched" the file it was back in the normal format, no more plist format.

From there it was smooth sailing.

Credit goes to my co-worker for suggesting the "touch" approach.

I'm not sure what caused the issue. Here are some details about my setup:

I'm running Xcode 7.3 (so I don't think it had anything to do with 7.3.1). I recently upgraded from Cocoapods 0.39.0 to 1.0. I think this is the culprit. I ran into issues building some pods with 1.0 which I resolved by forcing the use of 0.39.0 like this:

pod _0.39.0_ install
pod _0.39.0_ update

Hope this helps!

like image 160
Alfie Hanssen Avatar answered Sep 27 '22 21:09

Alfie Hanssen