xcode 如何添加复制 Pods 资源?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22792866/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:49:49  来源:igfitidea点击:

how to add Copy Pods Resources back?

xcodecocoapods

提问by Kiddo

I accidentally deleted "Copy Pods Resources", how can I add it back? I have tried 'pod install' and it doesn't work I have only one target in the project

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

回答by Kiddo

i found you need to edit project.pbxproj

我发现你需要编辑 project.pbxproj

to include those lines:

包括这些行:

E0F2945D18DC83D9006CC8FE is your target ID

E0F2945D18DC83D9006CC8FE 是你的目标 ID

in /* Begin PBXNativeTarget section */

在 /* 开始 PBXNativeTarget 部分 */

update build phases:

更新构建阶段:

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

then

然后

/* 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 */

回答by Wilmar

This has happened to me before. I've found that by removing all traces of Cocoapods from your project/folders and then doing a pod install, it puts back all the build phases etc.

我以前也遇到过这种情况。我发现通过从您的项目/文件夹中删除 Cocoapods 的所有痕迹,然后执行 a pod install,它会放回所有构建阶段等。

My steps:

我的步骤:

  • Delete the workspace
  • Delete the Pods folder
  • Delete the Podfile.lock file
  • From Build Phases tab, for the target you are working on, remove the 'Check Pods Manifest.lock' build phase (it will be the only Cocoapods build phase left since the resources step is gone to begin with)
  • Under Build Settings tab, for the target you are working on, remove any Cocoapods paths etc, if you want to be safe. When starting out with Cocoapods and not yet fully understanding it all, I also performed this step to make sure I start with a clean slate.
  • 删除工作区
  • 删除 Pods 文件夹
  • 删除 Podfile.lock 文件
  • 从 Build Phases 选项卡中,对于您正在处理的目标,删除“Check Pods Manifest.lock”构建阶段(这将是唯一的 Cocoapods 构建阶段,因为资源步骤已经消失)
  • 在 Build Settings 选项卡下,对于您正在处理的目标,如果您想安全,请删除所有 Cocoapods 路径等。当开始使用 Cocoapods 并且还没有完全理解它时,我也执行了这一步以确保我从一个干净的石板开始。

回答by de.

I just solved this by simply creating a 'Run Script Phase', naming it 'Copy Pods Resources' and the adding:

我只是通过简单地创建一个“运行脚本阶段”来解决这个问题,将其命名为“复制 Pods 资源”并添加:

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

Works for me.

对我来说有效。

回答by hiproz

normally this is add by the pod project. so ,what u need to do is only: pod install or pod update

通常这是由 pod 项目添加的。所以,你需要做的只是:pod install 或 pod update

回答by SarpErdag

Solved this problem by using "cocoapods-deintegrate". Simple and easy.

通过使用“cocoapods-deintegrate”解决了这个问题。简单易行。

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

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