如何添加Copy Pods Resources?

时间:2014-04-01 17:33:14

标签: xcode cocoapods

我不小心删除了“Copy Pods Resources”,如何将其添加回去? 我尝试过'pod install'但它不起作用 我在项目中只有一个目标

5 个答案:

答案 0 :(得分:1)

我发现你需要编辑project.pbxproj

包括这些行:

E0F2945D18DC83D9006CC8FE是您的目标ID

在/ *开始PBXNativeTarget部分* /

更新构建阶段:

buildPhases = (
            E0F2928A18DC83D9006CC8FE /* Check Pods Manifest.lock */,
            E0F2928A18DC83D9006CC8FE /* Sources */,
            E0F2930018DC83D9006CC8FE /* Frameworks */,
            E0F2932118DC83D9006CC8FE /* Resources */,
            E0F2945D18DC83D9006CC8FE /* ShellScript */,
            E0F2945E18DC83D9006CC8FE /* CopyFiles */,
            E0F2945E18DC83D9006CC8FE /* Copy Pods Resources */,
            );

然后

/* Begin PBXShellScriptBuildPhase section */
        E0F2945D18DC83D9006CC8FE /* ShellScript */ = {
            isa = PBXShellScriptBuildPhase;
            buildActionMask = 2147483647;
            files = (
            );
            inputPaths = (
            );
            outputPaths = (
            );
            runOnlyForDeploymentPostprocessing = 0;
            shellPath = /bin/sh;
            shellScript = "";
        };
        E0F2945D18DC83D9006CC8FE /* Copy Pods Resources */ = {
            isa = PBXShellScriptBuildPhase;
            buildActionMask = 2147483647;
            files = (
            );
            inputPaths = (
            );
            name = "Copy Pods Resources";
            outputPaths = (
            );
            runOnlyForDeploymentPostprocessing = 0;
            shellPath = /bin/sh;
            shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n";
            showEnvVarsInLog = 0;
        };
        E0F2945D18DC83D9006CC8FE /* Check Pods Manifest.lock */ = {
            isa = PBXShellScriptBuildPhase;
            buildActionMask = 2147483647;
            files = (
            );
            inputPaths = (
            );
            name = "Check Pods Manifest.lock";
            outputPaths = (
            );
            runOnlyForDeploymentPostprocessing = 0;
            shellPath = /bin/sh;
            shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n    cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n    exit 1\nfi\n";
            showEnvVarsInLog = 0;
        };
/* End PBXShellScriptBuildPhase section */

答案 1 :(得分:1)

之前发生在我身上。我发现通过从项目/文件夹中删除Cocoapods的所有痕迹然后执行pod install,它会放回所有构建阶段等。

我的步骤:

  • 删除工作区
  • 删除Pods文件夹
  • 删除Podfile.lock文件
  • 从Build Phases选项卡,对于您正在处理的目标,删除'Check Pods Manifest.lock'构建阶段(它将是资源步骤开始后唯一剩下的Cocoapods构建阶段)
  • 在“构建设置”选项卡下,对于您正在处理的目标,如果您想要安全,请删除所有Cocoapods路径等。当开始使用Cocoapods并且还没有完全理解它时,我也执行了这一步以确保我从一个干净的石板开始。

答案 2 :(得分:1)

我刚刚通过创建一个“运行脚本阶段”来解决这个问题,并将其命名为“复制播客资源”。和添加:

"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh"

适合我。

答案 3 :(得分:0)

使用&#34; cocoapods-deintegrate&#34;解决了这个问题。简单易行。

https://github.com/kylef/cocoapods-deintegrate

答案 4 :(得分:0)

通常,这是由pod项目添加的。因此,您只需要做的是:Pod安装或Pod更新