在用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

当前回答

我有同样的问题与Ionic-3,我做了一些上面提到的步骤,但没有一个对我有效。

为离子 移除ios平台

$ ionic cordova platform remove ios
$ ionic cordova platform add ios

打开xcode,然后尝试构建。 这对我很有用:-)

其他回答

如果您使用Windows进行Git签出和Podfile,也会发生这种情况。lock使用窗口(CRLF)行结束符创建。

如果你从github下载项目或从其他地方复制,那么依赖库不存在,就会出现这个问题。

你只需要cd到终端的project/project_name目录,使用ls检查是否有Podfile文件。

如果存在Podfile,你只需要安装依赖项:

pod install

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

一、项目清理

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

2更新CocoaPods

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

pod deintegrate <PROJECT>.XCODEPROJ // will deintegrate cocoapods
pod install // installs the pods

在我的案例中,我在集成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。