【问题标题】:Cocoapods cannot install podCocoapods 无法安装 pod
【发布时间】:2017-03-22 02:18:55
【问题描述】:

我在更新Podfile 后运行pod install,没有安装LeanCloud pod,我收到以下消息:

分析依赖关系 [!] 只有满足以下要求的预发布版本可用:

'LeanCloud', '>= 0'

您应该明确指定版本才能安装预发布版本

这是我的Podfile 的样子:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'todolist' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

# Pods for todolist
 pod 'Alamofire'
 pod 'SwiftyJSON'
 pod 'LeanCloud', '>= 0'
end

我在 macOS 10.12.3 上运行,Cocoapods 版本为 1.2.0

【问题讨论】:

  • 我试过你的 podfile,它工作正常
  • 这很奇怪。我尝试重新安装Cocoapods,更新 pod repo。什么都行不通。
  • @f_qi 您是否尝试过删除 .xcworspace 文件、pod 并进行 pod 安装/更新?
  • 我看到version 10.0.0 可用。所以你应该使用pod'LeanCloud','~>10.0.0'

标签: macos cocoapods podfile


【解决方案1】:

您必须指定要使用的依赖项的哪个版本。在这里看看版本控制的工作原理:

  1. == 1.0 表示“完全使用 1.0 版”
  2. >= 1.0 表示“使用 1.0 或更高版本”
  3. ~> 1.0 表示“使用与 1.0 兼容的任何版本”,本质上是指直到下一个主要版本之前的任何版本。那是:
    • 如果您指定 ~> 1.7.5,则从 1.7.5 到但不包括 2.0 的任何版本都被认为是兼容的。
    • 同样,如果您指定 ~> 2.0,那么 Cocoapods 将使用 2.0 或更高版本,但低于 3.0。
    • 兼容性基于Semantic Versioning

here,您必须选择要使用的LeanCloud 版本。然后根据上述步骤在您的 pod 文件中进行相应更改。

【讨论】:

  • 你试过pod 'LeanCloud', '>= 0',对吧?现在可以试试pod 'LeanCloud', '>= 10.0'吗??
【解决方案2】:

我的英语不太好 我认为您没有指定移动版本

platform :ios, '9.0'

【讨论】:

  • pod 'LeanCloud', '>= 0' 改变 pod 'LeanCloud', '~> 0'
【解决方案3】:

不知何故,我将pod LeanCloud 移动为第一个pod,然后运行pod update

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'todolist' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for todolist
 pod 'LeanCloud'
 pod 'Alamofire'
 pod 'SwiftyJSON' 
end

⇒ 吊舱更新
更新所有 pod
更新本地规范存储库

CocoaPods 1.2.1.beta.1 可用。 更新使用:sudo gem install cocoapods --pre
[!] 这是我们希望您尝试的测试版本。

有关详细信息,请参阅https://blog.cocoapods.org 和此版本的更改日志https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.1.beta.1

分析依赖关系
下载依赖项
安装 Alamofire 4.2.0(原为 4.4.0)
安装 LeanCloud (10.0.0)
使用 SwiftyJSON (3.1.4)
生成 Pod 项目
集成客户项目
发送统计数据
豆荚安装完成! Podfile 中有 3 个依赖项,总共安装了 3 个 pod。

【讨论】:

  • 这与您指定的 pod 的顺序无关。它目前正在工作,因为您尚未指定 pod 的 version。因此将使用最新版本。
  • 最初我尝试没有指定版本,但它给了我相同的信息,因为我指定了一个版本,然后我尝试了你的#2。相同的消息。这就是我在 SO 上发布这个问题的原因。
猜你喜欢
  • 2016-04-03
  • 2014-02-13
  • 1970-01-01
  • 2021-03-24
  • 1970-01-01
  • 1970-01-01
  • 2020-01-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多