沙箱与 Podfile.lock-ios 不同步

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31738339/
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-08-31 07:05:11  来源:igfitidea点击:

The sandbox is not in sync with the Podfile.lock-ios

iosxcodecocoapods

提问by Abdul Nouzil

I have got the following errors after trying multiple answers from the google.

在尝试了 google 的多个答案后,我遇到了以下错误。

PhaseScriptExecution Check\ Pods\ Manifest.lock /Users/apple/Library/Developer/Xcode/DerivedData/Build/Intermediates/FoodSpot.build/Debug-
    iphonesimulator/FoodSpotTests.build/Script-36819C3C1B6A30F50091382D.sh
        cd "/Users/apple/Downloads/FoodSpot 2"
        /bin/sh -c /Users/apple/Library/Developer/Xcode/DerivedData/Build/Intermediates/FoodSpot.build/Debug-iphonesimulator/FoodSpotTests.build/Script-36819C3C1B6A30F50091382D.sh

    diff: /../Podfile.lock: No such file or directory
    diff: /Manifest.lock: No such file or directory
    error: The sandbox is not in sync with the Podfile.lock. 
    Run 'pod   install' or update your CocoaPods installation.

I have updated and installed many times, but they are of no use.

我已经更新和安装了很多次,但它们都没有用。

采纳答案by Tharif

Run 'pod install' or update your CocoaPods installation.

运行“pod install”或更新你的 CocoaPods 安装。

You have answer in the error itself !

你有错误本身的答案!

The error message states that you should update your CocoaPodsinstallation.

该错误消息指出您应该更新CocoaPods安装。

You could remove libPods in frameworks and libraries and update Cocoapods using pod install.

您可以删除框架和库中的 libPods 并使用pod install.

Also:

还:

clean and build the project

清理并构建项目

SO references :

所以参考:

CocoaPods Errors on Project Build

项目构建中的 CocoaPods 错误

Error:"The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods

使用 cocoapods 安装 RestKit 后出现错误:“沙箱与 Podfile.lock 不同步...”

回答by Arthur Kazemi

For me, the reason was missign User-Defined variables in the Build Settings!

对我来说,原因是在构建设置中错误地分配了用户定义的变量!

Looking into the issue, the Build Phases tries to diff 2 files.

调查这个问题,构建阶段尝试区分 2 个文件。

diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null

Just because of missing PODS_PODFILE_DIR_PATH and PODS_ROOT variables, assumes them as "" so ${PODS_PODFILE_DIR_PATH}/Podfile.lock points to /Podfile.lock and same for the other one.
So it fails in

仅仅因为缺少 PODS_PODFILE_DIR_PATH 和 PODS_ROOT 变量,将它们假定为 "" 所以 ${PODS_PODFILE_DIR_PATH}/Podfile.lock 指向 /Podfile.lock 并且另一个相同。
所以它失败了

diff /Podfile.lock and /Manifest.lock

diff /Podfile.lock and /Manifest.lock

I fixed this by adding 2 User-Defined settings to the Build Settings

我通过在构建设置中添加 2 个用户定义的设置来解决这个问题

PODS_ROOT = ${SRCROOT}/Pods
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

After hours of searching this is the only solution that worked for me

经过数小时的搜索,这是唯一对我有用的解决方案

回答by David Cheung

For me, it works after the following:

对我来说,它在以下操作后起作用:

pod deintegrate --verbose    
pod install --verbose

回答by Eddie

I had been searching for hours and I found solutions as follow:

我一直在寻找几个小时,我找到了以下解决方案:

In my case, method 3 works.

就我而言,方法 3 有效。

Method 1:

方法一:

  1. choose the target > go to Build Phrases> click Link Binary With Libraries> remove all libPods.afiles
  2. open Terminal > direct to your project > run:

     pod install
    
  3. clean and build project

  1. 选择目标 > 转到Build Phrases> 单击Link Binary With Libraries> 删除所有libPods.a文件
  2. 打开终端>直接到您的项目>运行:

     pod install
    
  3. 清理并构建项目

ref.1

参考文献 1

Method 2:

方法二:

  1. open Terminal > direct to your project > run:

    pod deintegrate --verbose    
    pod install --verbose
    
  1. 打开终端>直接到您的项目>运行:

    pod deintegrate --verbose    
    pod install --verbose
    

ref.2

参考文献 2

Method 3:

方法三:

  1. choose the target > go to Build Settings> click "+" sign
  2. add 2 User-Defined Settings: [to the left = to the right]

    PODS_ROOT = ${SRCROOT}/Pods
    

    and

    PODS_PODFILE_DIR_PATH = ${SRCROOT}/
    
  1. 选择目标>转到构建设置>单击“+”号
  2. 添加 2 个用户定义的设置:[向左 = 向右]

    PODS_ROOT = ${SRCROOT}/Pods
    

    PODS_PODFILE_DIR_PATH = ${SRCROOT}/
    

ref.3

参考文献 3

回答by Sudhir Mann

Just go to Build phases and click on [CP]check Pods Manifest.lock.

只需转到构建阶段并单击 [CP]check Pods Manifest.lock。

diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null

Both PODS_PODFILE_DIR_PATH and POD_ROOT should define in user-Defined in build settings. POD_ROOT should have correct path to Manifext.lock file and POD_PODFILE_DIR_PATH should have correct path for Podfile.lock

PODS_PODFILE_DIR_PATH 和 POD_ROOT 都应该在用户定义的构建设置中定义。POD_ROOT 应该有 Manifext.lock 文件的正确路径,POD_PODFILE_DIR_PATH 应该有 Podfile.lock 的正确路径

So Add below in build settings.

所以在构建设置中添加下面。

PODS_ROOT ---- ${SRCROOT}/Pods

PODS_PODFILE_DIR_PATH ---- ${SRCROOT}

回答by Hyman Vial

The problem is Podfile.lock and Manifest.lock cannot be found by the Check Pods Manifest.lock Script in your targets build phase.

问题是 Podfile.lock 和 Manifest.lock 在目标构建阶段无法被 Check Pods Manifest.lock 脚本找到。

enter image description here

enter image description here

This is usually caused by PODS_PODFILE_DIR_PATH and PODS_ROOT variables not being defined.

这通常是由未定义 PODS_PODFILE_DIR_PATH 和 PODS_ROOT 变量引起的。

Go to build settings tab to define them.

转到构建设置选项卡来定义它们。

enter image description here

enter image description here

You will need to look for Podfile.lock and Manifest.lock in your project and get the the full paths of their directories. The directory paths will be the values you use for PODS_PODFILE_DIR_PATH and PODS_ROOT.

您需要在项目中查找 Podfile.lock 和 Manifest.lock 并获取其目录的完整路径。目录路径将是您用于 PODS_PODFILE_DIR_PATH 和 PODS_ROOT 的值。

回答by Martin Jacob

Deleting the derived data did the trick for me . I deleted by going into the finder itself.

删除派生数据对我来说很有效。我通过进入查找器本身删除了。

回答by Apurv Pandey

Make changes in the podfile as given below:

在 podfile 中进行如下更改:

Older pod file

较旧的 pod 文件

target :TargetName, :exclusive => true do

目标 :TargetName, :exclusive => true

Changed pod file

更改了 pod 文件

target 'TargetName' do

目标 'TargetName' 做

回答by Randika Vishman

I'm pretty sure that you have opened your Projects' workspace which you try to install new Pods. So try out the following (for me this worked):

我很确定您已经打开了您尝试安装新 Pod 的项目工作区。因此,请尝试以下操作(对我来说这是有效的):

  1. Clean the project
  2. Close the project
  3. Run pod install
  4. Open the project and try re-building it once more
  1. 清理项目
  2. 关闭项目
  3. pod install
  4. 打开项目并再次尝试重新构建它

Problem might have been resolved.

问题可能已经解决。

回答by Burak ?ztürk

In my case, I got same error after integrating my other targets. To solve problem I needed to add both targets in Podfile:

就我而言,在集成其他目标后,我遇到了同样的错误。为了解决问题,我需要在 Podfile 中添加两个目标:

abstract_target 'myApp' do
   use_frameworks!

   pod 'Alamofire', '~> 3.0'
   pod 'SwiftyJSON'

    target 'myAppOtherTarget'
end