Xcode 4 project: utility to clean up pbxproj file?

I tried gorbster's method with no success (though it has solved similar problems for me in the past).

I went into my project.pbxproj file (inside the .xcodeproj package for the project) and found two lines that looked a little suspicious, both of the form:

53A45F8F138FE6F40077017F /* (null) in Resources */ = {isa = PBXBuildFile; };

I deleted the lines, and voilà: I can access my build settings for this target again.

No idea how they got in there in the first place. I would guess something to do with a faulty merge under SVN.

Ran into the same issue this morning after pulling a colleague's merge.

I was able to fix this with the following:

  1. Close Xcode
  2. Open the .xcodeproj package in Finder
  3. Delete the project.xcworkspace file/package
  4. Open the xcuserdata folder and delete your user-specific .xcuserdatad folder.
  5. Re-Open Xcode and project

I lost some minor user preferences (file and tab history, etc), but can now click all (9) of my targets without issue. Turns out my colleague was on an earlier version of Xcode, but I'm not sure if this contributed to the IDE crashing.

Ben Mosher found the solution. And yes it is due to SVN merge problem.

As we working in team with SVN the error occur often so I wrote a bash script:

sed "/(null) in/d" project.pbxproj > tmp_project.pbxproj
mv tmp_project.pbxproj project.pbxproj