解决cocoapods diff: /../Podfile.lock: No such file or directory

网上Git一份代码,想学习一下,在执行pod update之后build工程遇到如下提示错误:

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.

然后网上查找了一下,目前具体有三种解决方案:
Methond One
关闭Xcode,重新执行pod install,之后再重新打开Xcode运行。
Methond Two
删除下面几个文件:

xcworkspace
Podfile.lock
Pods文件夹
~/Library/Developer/Xcode/DerivedData路径下对应工程的文件夹
再重新执行od install
Methond Three
第一步:设置Configurations
选中Project->选择Info tab->看看Configurations是不是被设置为 None了,如果是None的话请改为Pods,如下图:

解决cocoapods diff: /../Podfile.lock: No such file or directory_第1张图片
Configurations 信息.png

第二步:修正Pods脚本文件路径

1)右键工程根目录下的xxx.xcodeproj文件,显示包内容
2)双击打开project.pbxproj文件
3)查找"Pods-resources.sh", 把路径改为如下红框处(如图脚本.png):
4)重新打开工程(双击workspace文件),到此应该是能正常编译运行了.

解决cocoapods diff: /../Podfile.lock: No such file or directory_第2张图片
脚本.png

倘若在Pod install 时候出现下面错误提示:

[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `master-1`.
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.

这个原因是由于我装了多个Xcode导致路径变了.

解决方法如下图:


解决cocoapods diff: /../Podfile.lock: No such file or directory_第3张图片
终端操作步骤.png

然后在pod install 即可.

你可能感兴趣的:(解决cocoapods diff: /../Podfile.lock: No such file or directory)