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

80.9k Views Asked by At

I have got the following errors after trying multiple answers from the 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.

22

There are 22 best solutions below

2
On BEST ANSWER

Run 'pod install' or update your CocoaPods installation.

You have answer in the error itself !

The error message states that you should update your CocoaPods installation.

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

Also:

clean and build the project

SO references :

CocoaPods Errors on Project Build

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

0
On

Im facing the same issue now and fixed using this command after navigating to project location in terminal.

pod install --repo-update
1
On

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

enter image description here

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

Go to build settings tab to define them.

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.

0
On

For me, it works after the following:

pod deintegrate --verbose    
pod install --verbose
0
On

Please check Top Sites - Sandbox Sync iOS for more explanation. I fixed the issue by changing file paths from

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

to

diff "${SRCROOT}/Podfile.lock" "${SRCROOT}/Pods/Manifest.lock" > /dev/null

in Xocde -> "Open Your Project" -> "Select Your Project" -> "Select Your Target" -> Build Phases -> Check Pods Manifest.lock

If not, try changing paths as mentioned above, along with Legacy Build System. To change build system Xcode -> File -> Workspace Settings -> Build System -> Legacy Build System

0
On

I hate to say this, but I just removed the pods/ or didn't include them in the project and it built. I don't know if this will have a long-term effect on the project though.

This is presently my .sh build script for ionic5 for ios. It will probably change in the future.

# BUILDING FOR IOS

##################################
#
#     MAKE SURE YOU UNPLUG ALL DEVICES!!!!!
#
##################################

 
ionic cordova platform remove ios
ionic cordova prepare ios 
ionic cordova platform add ios
ionic cordova build ios --prod --release --buildFlag="-UseModernBuildSystem=0" --verbose
cd platforms
cd ios
open "MyApp.xcworkspace/"
cd ..
cd ..

It had be plaguing my project, so I thought I'd take them out. I am yet to deploy the project so far though... so who knows. BigSur 11.1, XCode 12.4 (12D4e)

0
On

If you happen to move your Podfile like i did and face this issue, the solution discussed below may help -

  1. Delete all of the following - Pods folder, xcworkspace file, podlock file (skip the ones that are not available for subfolders)
  2. delete all steps that has [cp] in it from the build phase tab
  3. repeat step 1 & 2 for all the sub projects that you have in your workspace
  4. open workspace, go into each project and delete framework for pods, and delete the pods folder from each project
  5. close workspace
  6. run pod install

you should now be able to open, build and run the project

0
On

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

In my case, method 3 works.

Method 1:

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

     pod install
    
  3. clean and build project

ref.1

Method 2:

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

    pod deintegrate --verbose    
    pod install --verbose
    

ref.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}/
    

ref.3

0
On

Edit

It turned out my issue was due to a new line at the end of the Manifest.lock that was not present in the PodFile.lock file. Running a diff on the two files highlighted the issue.

Adding a new line to the end of the PodFile.lock file solved it.

Original Answer

None of the answers have worked for me so I have just checked the "For install builds only" under "[CP] Check Pods Manifest. lock" which is found in the build phases tab.

I believe this setting means it will only run that check when archiving, allowing me to continue developing as I don't need to archive the app on my machine.

Use with caution though as it may not be the best solution for everyone.

[CP] Check Pods Manifest.lock

0
On

I had the same issue. Turned out the cocoapods version on Manifest.lock was higher than what I had on my mac. I had to do a 'sudo gem install cocoapods', to get the version of the cocoapods upto what was specified on the Manifest.lock file. This fixed the issue and I had no errors on building the project.

0
On

Make changes in the podfile as given below:

Older pod file

target :TargetName, :exclusive => true do

Changed pod file

target 'TargetName' do

0
On

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

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

I think you are trying to use your old project pod folder in your current project, you have to copy Manifest.lock file of your current project and replace that file in your old project's pod folder which you added. Manifest.lock file location YourProject->Pods->Manifest.lock Hope This was helpful. worked for me!

0
On

Just go to Build phases and click on [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

So Add below in build settings.

PODS_ROOT ---- ${SRCROOT}/Pods

PODS_PODFILE_DIR_PATH ---- ${SRCROOT}
0
On

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

0
On

Make sure you add a "pod install" command line build step, before the Xcode Project build step.

The error is coming from the build phase run script in your Xcode project's target, which is unable to find Podfile.lock. This file is generated by CocoaPods, which must be installed in a build step in your TeamCity project.

My build steps look like:

  1. Command line: bundle install --path .bundle (installs cocoapods local to the project using Gemfile).
  2. Command line: bundle exec pod install --verbose (uses Podfile)
  3. Command line: carthage update --platform iOS (uses Cartfile)
  4. Xcode Project
  5. Command line to build an archive
  6. Command line to upload a build

Hope this helps.

0
On

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):

  1. Clean the project
  2. Close the project
  3. Run pod install
  4. Open the project and try re-building it once more

Problem might have been resolved.

0
On

In my case, the errors were occurring on a _Tests target. I didn't need the _Tests target, and so I deleted it. This resolved the error.

0
On

This happens if cocoa pods don't install or uninstall properly

If you want to install cocoa pods run

pod install

if you you want to uninstall cocoa pods then run command

pod deintegrate
0
On

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

abstract_target 'myApp' do
   use_frameworks!

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

    target 'myAppOtherTarget'
end
7
On

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.

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

diff /Podfile.lock and /Manifest.lock

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

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

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

0
On

I just fixed it by updating the Cocoapod, cause before the error there was log where the warning shows we need to upgrade our cocoapods as the pod files are not supported by the current cocoapod version, So clean the project , upgrade cocoapod then install pod.

1. Clean project
2. sudo gem install cocoapods/gem install cocoapods
3. pod install (optional if your project still shows error)

Note: I found this error for my flutter application in iOS platform