truebit / xUnique

merge Xcode project file is so easy
https://fclef.wordpress.com
Other
1.5k stars 120 forks source link

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

Closed palexs closed 8 years ago

palexs commented 8 years ago

The script I use is: echo "Running xUnique..." xunique "${PROJECT_FILE_PATH}/project.pbxproj" xunique "${PODS_ROOT}/Pods.xcodeproj/project.pbxproj"

When added as a build phase the error for Pods.xcodeproj/project.pbxproj is: "File 'project.pbxproj' is broken. Cannot find PBXProject name."

When added as the scheme's post build step it ignores Pod.xcodeproj/project.pbxproj completely and doesn't change identifiers.

truebit commented 8 years ago

I suggest using as git hook. Many issues reported that other methods would fail due to project file changing in progress by Xcode and/or cocoapods

Sent from my mobile device.

在 2016年6月16日,00:45,Alexander notifications@github.com 写道:

The script I use is:

Uniquify and sort the Xcode project files

echo "Running xUnique..." xunique "${PROJECT_FILE_PATH}/project.pbxproj" xunique "${PODS_ROOT}/Pods.xcodeproj/project.pbxproj"

When added as a build phase the error for Pods.xcodeproj/project.pbxproj is: "File 'project.pbxproj' is broken. Cannot find PBXProject name."

When added as the scheme's post build step it ignores Pod.xcodeproj/project.pbxproj completely and doesn't change identifiers.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

palexs commented 8 years ago

@truebit thanks for prompt reply!

palexs commented 8 years ago

@truebit I've tried using pre-commit hook, but I still get the same error. It seems like Pods.xcodeproj/project.pbxproj has different structure in comparison with MyProject.xcodeproj/project.pbxproj:

MyProject.xcodeproj/project.pbxproj:

/* Begin PBXProject section */
        6AE1FE371486FDD200743640 /* Project object */ = {
            isa = PBXProject;
            attributes = {
                        ...
                        }
/* End PBXProject section */

Pods.xcodeproj/project.pbxproj:

<key>isa</key>
<string>PBXProject</string>
truebit commented 8 years ago

Ah I know. Cocoapods would convert project file to XML format by default. check this link Maybe you need to convert it back to ASCII format:

Since CocoaPods 0.24.0 (see CHANGELOG.md, CocoaPods automatically converts the generated xcodeproj file to ASCII format if the xcproj is available in the PATH.

palexs commented 8 years ago

@truebit that's exactly what I've been looking for! Thanks a lot!