Getting a (null) reference in the Xcode pbxproj file

Dee-Bha picture Dee-Bha · Nov 16, 2017 · Viewed 7.8k times · Source

Upon updating/bumping up the version and the build # in Xcode version 9.1, I saw the following upon doing git diff

diff --git a/star.xcodeproj/project.pbxproj b/star.xcodeproj/project.pbxproj
index c4601526..8fa3c762 100644
--- a/star.xcodeproj/project.pbxproj
+++ b/star.xcodeproj/project.pbxproj
@@ -767,7 +767,7 @@

- F4487BE11FB28C400079BAAD /* BuildFile in Sources */ = {isa = PBXBuildFile; };
+ F4487BE11FB28C400079BAAD /* (null) in Sources */ = {isa = PBXBuildFile; };

@@ -5625,7 +5625,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- F4487BE11FB28C400079BAAD /* BuildFile in Sources */,
+ F4487BE11FB28C400079BAAD /* (null) in Sources */,);

    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
-       <string>2.11.4</string>
+       <string>2.11.5</string>
      <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleURLTypes</key>
@@ -39,7 +39,7 @@
            </dict>
    </array>
    <key>CFBundleVersion</key>
-       <string>02110400</string>
+       <string>02110500</string>
    <key>FacebookAppID</key>
    <string>70858204300</string>
    <key>FacebookBetaAppID</key>

All I did was bump up the version of the project. But upon doing a git status and a git diff, I see some null references in the .pbxproj file. Has anybody else seen this. As a side-note we also use Cocoapods in our project.

Answer

Uladzimir picture Uladzimir · Jun 20, 2018

Remove all occurrences of (null) in Sources lines in your project.pbxproj:

sed -i '' '/(null) in Sources /d' YOURPROJECT.xcodeproj/project.pbxproj