在用cocoapods安装RestKit之后,我遇到了一个奇怪的问题。 在用cocoapods解决我的项目的RestKit依赖关系并试图构建它之后,我面临这个错误:

沙箱与Podfile.lock不同步。运行“pod install”或更新CocoaPods安装。

我试着运行pod安装,但没有变化。

以下是一些照片:

  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

当前回答

如果您正在应用项目清理的方式,而您的项目仍然出错。

你可以去标签构建阶段,然后找到检查Pods清单。锁定并删除脚本。

然后输入命令删除文件夹Pods,如rm -rf Pods

然后你需要删除Podfile。通过命令rm Podfile.lock锁定

可能,基于某种情况,您可以删除文件your_project_name.xcworkspace

最后,你需要命令来安装Pod Pod install——repo-update。

希望你能想到这个解决方案。快乐编码:)

其他回答

我错了:

diff: / . . / Podfile。diff: /Manifest. lock:没有这样的文件或目录。lock:没有这样的文件或目录错误:沙箱没有与Podfile.lock同步。

我第一次从bitbucket中提取请求。我清理了我的项目,尝试了所有的方法(pod安装,pod更新等),但上面的答案都不适合我。然后我只是检查我安装吊舱的路径,并纠正它,重新安装,它只是工作。确保在.xcodeproj或.xcworkspace(如果已经存在的话)存在的位置前面给出路径。也许有人会从中受益。

我可以通过更新CocoaPods来解决这个问题。

一、项目清理

在项目导航器中,选择您的项目 选择目标 删除所有libpod *。a在构建阶段>链接二进制与库

2更新CocoaPods

启动终端并转到项目目录。 使用命令荚install更新CocoaPods

Completely nothing worked out for me from these answers. Had to create the project again by running cordova platform add ios. What I've noticed, even freshly generated project with (in my case) Firebase pods caused the error message over and over again. In my opinion looks like a bug for some (Firebase, RestKit) pods in Xcode or CocoaPods. To have the pods included I could simply edit my config.xml and run cordova platform add iOS, which did everything for me automatically. Not sure if it will work in all scenarios though.

编辑:我有一个Podfile从以前的iOS/Xcode,但最新的今天有# DO NOT MODIFY -自动生成的Apache Cordova在Podfile。这让我的脑海中亮起了一盏灯,开始尝试这种方法。看起来有点琐碎,但很管用,我的Firebase功能也很管用。

对我有效的步骤(XCode 8.3.3/XCode 9 beta与Swift 3.1项目)

 - 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

另外,在使用pods时,请确保打开的是.xcworkspace文件而不是项目文件(.xcodeproj)。这应该解决任何错误的链接,如“苹果Mach -O链接器命令失败”

在我的案例中,我在集成WatchKit应用程序后得到了同样的错误。为了解决问题,我需要在Podfile中添加WatchKit的两个目标:

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:也许这发生在我身上,因为我错误地为MyProject WatchKit应用程序目标最初安装了pods。