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

当前回答

在项目中检查pod可能没有被推送到Git。所以很明显compile将会崩溃,因为它无法找到Pods目录

 diff "${PODS_ROOT}/../../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null

我通过在终端中导航到我的项目目录后发出pod install来解决这个问题。

事实上,我有一个错误无法找到pod命令,这意味着cocoapods没有安装。这是通过gem install cocoapods来修复的。如果遇到依赖项错误,只需安装报告丢失的每个命令。在我的情况下,我必须更新Ruby,在cocoapods正确安装后,我可以使用命令舱安装。

PS.如果你有pod目录,尝试pod更新。也许你的库需要更新。

其他回答

如果你在Podfile中删除目标的所有pod,例如:

target 'myTarget' do
pod 'great-stuff', '~> 4.0'  // you deleted this last pod
end

你需要从你的Xcode目标构建阶段手动删除这些构建步骤:

检查pod Manifest.lock 复制Pod资源

Cocoapods(当前稳定版本0.37.2)在运行pod install时不执行此清理。

经过多次尝试,我终于解决了这个问题。变量${PODS_ROOT}没有设置,我做下面的技巧。 去构建阶段->检查Pods清单。锁定和替换

diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null

to

diff "${SRCROOT}/Podfile.lock" "${SRCROOT}/Pods/Manifest.lock" > /dev/null

这对我有帮助。

我试了一切办法,但问题还是没有解决。 在那之后,我这样做了,它工作尽快(尽可能顺利)。

打开.xcworkspace文件。 如果在Xcode 10上使用Cordova,则更改为遗留构建系统。 转到Podfile的目标/项目。选择“部署traget”为11+ 然后将调试和发布更改为Pods-.build/release。在我的例子中是App.debug/release。图片附呈。希望能有所帮助。

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

如果你的舱是空的

删除复制豆荚资源和检查豆荚清单。 从构建阶段锁定项目的设置