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

当前回答

我使用包中的可可荚安装。

安装打包机 在项目根目录中添加Gemfile 在Gemfile中添加所需的宝石 包安装 然后总是使用bundle exec pod install

如果你不知道如何操作这些步骤之一,在谷歌上搜索会有帮助:)

其他回答

我使用包中的可可荚安装。

安装打包机 在项目根目录中添加Gemfile 在Gemfile中添加所需的宝石 包安装 然后总是使用bundle exec pod install

如果你不知道如何操作这些步骤之一,在谷歌上搜索会有帮助:)

我在最新的ComponentKit 0.14上也有同样的问题。 原因是PODS_ROOT没有设置,我发现解决方案是添加一行到ComponentKit。xcconfig:

#include "../Pods/Target Support Files/Pods-ComponentKit/Pods-ComponentKit.debug.xcconfig"

我有这个问题时,我试图删除以前安装的库

@Michal的回答帮助了我

删除或卸载之前添加的库:cocoapods

对我有效的步骤(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链接器命令失败”

我也犯了同样的错误。首先我更新cocoapods使用

sudo gem install cocoapods

然后安装Pod使用Pod安装命令为我工作。