问题
I've encounter an strange issue after installing RestKit with cocoapods. after resolving RestKit dependency for my project with cocoapods and trying to build it, I face this error:
The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
I tried running pod install
, but no change.
Here are some shots:
PODS:
- AFNetworking (1.3.3)
- RestKit (0.20.3):
- RestKit/Core
- RestKit/Core (0.20.3):
- RestKit/CoreData
- RestKit/Network
- RestKit/ObjectMapping
- RestKit/CoreData (0.20.3)
- RestKit/Network (0.20.3):
- AFNetworking (~> 1.3.0)
- RestKit/ObjectMapping
- RestKit/Support
- SOCKit
- RestKit/ObjectMapping (0.20.3)
- RestKit/Search (0.20.3):
- RestKit/CoreData
- RestKit/Support (0.20.3):
- TransitionKit (= 1.1.1)
- RestKit/Testing (0.20.3)
- SOCKit (1.1)
- TransitionKit (1.1.1)
DEPENDENCIES:
- RestKit (~> 0.20.0)
- RestKit/Search (~> 0.20.0)
- RestKit/Testing (~> 0.20.0)
SPEC CHECKSUMS:
AFNetworking: 61fdd49e2ffe6380378df37b3b6e70630bb9dd66
RestKit: 1f181c180105a92f11ec4f6cd7de37625e516d83
SOCKit: 2f3bc4d07910de12dcc202815e07db68a3802581
TransitionKit: d0e3344aac92991395d4c2e72d9c5a8ceeb12910
COCOAPODS: 0.29.0
回答1:
I was able to fix that by updating CocoaPods.
I. Project Cleanup
- In the project navigator, select your project
- Select your target
- Remove all libPods*.a in Build Phases > Link Binary With Libraries
II. Update CocoaPods
- Launch Terminal and go to your project directory.
- Update CocoaPods using the command
pod install
回答2:
After many attemps I managed to fix this problem. Variable ${PODS_ROOT} was not set and I do below trick. Go to Build Phases -> Check Pods Manifest.lock and replace
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
to
diff "${SRCROOT}/Podfile.lock" "${SRCROOT}/Pods/Manifest.lock" > /dev/null
It helps me.
回答3:
If you remove all pods from your target in the Podfile, e.g.
target 'myTarget' do
pod 'great-stuff', '~> 4.0' // you deleted this last pod
end
you'll need to manually delete these builds steps from your Xcode target Build Phases:
- Check Pods Manifest.lock
- Copy Pod resources
Cocoapods (current stable version 0.37.2) does not perform this cleanup when you run pod install
.
回答4:
Removing pods from the project and re-installing worked for me.
There is nice GitHub repository that can completely remove the pods from the project.
Just keep the backup of your PodFile and run below commands.
- gem install cocoapods-deintegrate
- gem install cocoapods-clean
- Go to the project directory and run pod deintegrate
- Again run pod clean
- Run pod install
Clean and run.
回答5:
I had been searching for hours and I found solutions as follow:
In my case, method 1 works.
Method 1:
- choose the target > go to Build Phrases > click Link Binary With Libraries > remove all libPods.a files
open Terminal > direct to your project > run:
pod install
clean and build project
ref.1
Method 2:
open Terminal > direct to your project > run:
pod deintegrate --verbose pod install --verbose
ref.2
Method 3:
- choose the target > go to Build Settings > click "+" sign
add 2 User-Defined Settings: [to the left = to the right]
PODS_ROOT = ${SRCROOT}/Pods
and
PODS_PODFILE_DIR_PATH = ${SRCROOT}/
ref.3
回答6:
After changing target name
My problem was xcconfig with old target names.
- Went to project file -> info -> configuration
- Removed old xcconfig (both Debug & Release)
- pod install
It would update to new ones.
Also if you had missing .h files that's the reason (pods header search path is in these xcconfig)
回答7:
If you are seeing an error like the following:
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.
Then there's a problem with Cocoapods in your project. Sometimes cocoapods can get out of sync and you need to re-initiate cocoapods. You should be able to resolve this error by:
- Deleting the Podfile.lock file in your project folder
- Deleting the Pods folder in your project folder
- Execute 'pod install' in your project folder
- Do a "Clean" in Xcode
- Rebuild your project
回答8:
In my case, I got same error after integrating WatchKit app. To solve problem I needed to add both targets of WatchKit in Podfile:
target 'MyProject WatchKit App' do
platform :watchos, '2.0'
shared_pods
end
target 'MyProject WatchKit App Extension' do
platform :watchos, '2.0'
shared_pods
end
PS: Maybe this happened for me because I mistakenly installed pods for MyProject WatchKit App
target initially.
回答9:
I encountered this issue with a misconfigured xcconfig file.
The Pods-generated xcconfig was not correctly #included in the customise xcconfig that I was using. This caused $PODS_ROOT to not be set resulting in the failure of diff "/../Podfile.lock" "/Manifest.lock"
, for obvious reasons, which Pods misinterprets as a sync issue.
回答10:
For me the problem was that I made a new target in my app by duplicating an existing one, but forgot to add the target to the Podfile
. For some reason, the cloned target did work for days without problems, but after a while it failed to build by this error. I had to create a new target entry for my cloned project target in the Podfile then run pod install
.
回答11:
I found my solution: Run:pod update
instead of pod install
. The error was fixed!
回答12:
- Go to Build Phases -> Check Pods Manifest.lock
- Replace
${PODS_ROOT}/Manifest.lock
with:
${SRCROOT}/Podfile.lock" "${SRCROOT}/Pods/Manifest.lock
Check in image :
回答13:
If you download the project from github or copy from other place, then the dependencies library do not exists, there will be this issue.
You just need to cd
to the project/project_name directory
in terminal , use ls
to check whether there is a Podfile
file.
if there exists the Podfile
, you just need to install the dependencyies:
pod install
回答14:
I tried everything, but the problem persisted. After that I did this and it worked ASAP (As Smooth As Possible).
- Open the .xcworkspace file.
- Change to legacy build system if using Cordova on Xcode 10.
- Go to target/project of Podfile. Select Deployment traget as 11+
- Then Change the debug and release to Pods-.build/release. It was App.debug/release in my case.Pic attached. Hope it helps.
回答15:
My working answer is:
- Install update your cocoapods by this command: pod update
- Install your new pods by this command. pod install
- Last one command: sudo gem install cocoapods.
回答16:
When you do
pod install --verbose
make sure:
1- you are in the correct directory. Most times, when a github project is downloaded, there will be a master folder. You need to be inside the actual project name folder(masterfolder/project folder) in the terminal before you invoke pod install --verbose
2- Delete the old pod lock folder then clean the project using xcode clean & do pod install.
3- Keep your rvm updated.
回答17:
My problem was the cocoa pods version so I installed the latest with:
sudo gem install cocoapods --pre
Then pod update
That worked for me
回答18:
The steps that worked for me (XCode 8.3.3/XCode 9 beta with a Swift 3.1 project
)
- Navigate to your project directory
- pod install //which then asks you to do the next step
- pod repo update //takes a while to update the repo
- pod update
- pod install
- Close Xcode session
- Open and Clean the project
- Build/Run
Also make sure you open the .xcworkspace file rather than the project file (.xcodeproj) when working with pods
. That should solve any errors with linking such as "Apple Mach -O Linker command failed"
回答19:
If you are applying to the way Project Cleanup and your project still error.
You can go to tab Build Phases and then Find Check Pods Manifest.lock
and remove the script.
Then type command to remove folder Pods
like that rm -rf Pods
and then you need to remove Podfile.lock by command rm Podfile.lock
Probably, base on a situation you can remove file your_project_name.xcworkspace
Finally, you need the command to install Pod pod install --repo-update
.
Hopefully, this solution comes up with you. Happy coding :)
回答20:
I had same error. First I update cocoapods using
sudo gem install cocoapods
then install pods using Pod install command worked for me.
回答21:
For me, working in flutter, the configuration was not automatically added due the existing configuration.
Adding #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
to Flutter/Release.xcconfig
and Flutter/Debug.xcconfig
solved the issue.
回答22:
Run this, and your errors will vanish
rm -rf Pods && gem install cocoapods && pod install
回答23:
I faced this problem in a Flutter project. I just opened iOS Module in xCode and Build Clean Folder worked for me.
回答24:
if your pods are empty
- remove copy pods resources and check pods manifest.
- lock from build phases settings of your project
回答25:
My problem was when my fellow developer added a pod in the project and then i pull the project using github then the error occurred. I ran pod install and it updated the pods with new library which was added by my fellow developer. hope it helps.
回答26:
I have the same problem with latest ComponentKit 0.14. The reason is PODS_ROOT was not set and i have found the solution is add a line to ComponentKit.xcconfig :
#include "../Pods/Target Support Files/Pods-ComponentKit/Pods-ComponentKit.debug.xcconfig"
回答27:
Check in your project that Pods are maybe not being pushed to Git. So it's obvious that compile will break since it cannot find the Pods directory
diff "${PODS_ROOT}/../../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
I solved this by issuing pod install
in the Terminal after navigating to my project's directory.
Indeed, I had an error cannot find pod command
which meant that cocoapods
were not installed. This is fixed via gem install cocoapods
. If you get any dependency error, just install each command that is reported missing. In my case I had to update Ruby and after that cocoapods
were installed properly and I was able to use the command pod install
.
PS. If you have Pods directory, try pod update
. Maybe your library needs updating.
回答28:
i had this issue when i was trying to remove previously installed library
@Michal's answer helped me
Remove or uninstall library previously added : cocoapods
回答29:
I accidentally removed and then unpack back folder from where I tried to install pod.
It was like this:
1) cd in your project folder
2) zip your project
3) remove project folder
4) unzip folder back
5) from now even you have this folder you should go to this folder again from the terminal
回答30:
I had error:
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.
I pulled request from bitbucket for first time. I cleaned my project and tried everything(pod install, pod update etc.) but none of the above answer worked for me. Then I just check the path where I was installing the pod and corrected it and installed again,It just worked. Make sure give the path just before where .xcodeproj or .xcworkspace(if it is already there)exist. May be someone get benefitted from this.
来源:https://stackoverflow.com/questions/21366549/error-the-sandbox-is-not-in-sync-with-the-podfile-lock-after-installing-re