【问题标题】:Unable to download Library using cocoaPods无法使用 cocoaPods 下载库
【发布时间】:2017-07-06 09:21:19
【问题描述】:

我是 swift 编程新手。我正在尝试下载该项目的库。我已经安装了可可豆荚:sudo gem install cocoa pods,创建了包含我需要的所有库的 pod 文件:pod 'GoogleMaps'。 pod install 后出现错误:

 Unable to satisfy the following requirements:

 - `GoogleMaps` required by `Podfile`
 - `GoogleMaps` required by `Podfile`
 - `GoogleMaps (= 2.3.1)` required by `Podfile.lock`

 Specs satisfying the `GoogleMaps, GoogleMaps (= 2.3.1)` dependency    
 were found, but they required a higher minimum deployment target.

 [!] Automatically assigning platform ios with version 7.0 on target 
  Taxi for rider because no platform was specified. Please specify a 
 platform    for this target in your Podfile. See   
 `https://guides.cocoapods.org/syntax/podfile.html#platform`.

我的 pod 文件:

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

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

  # Pods for Taxi for rider
  pod 'Firebase'
  pod 'Firebase/Storage'
  pod 'Firebase/Auth'
  pod 'Firebase/Database'
  pod 'GoogleMaps'
  pod 'GoogleMaps'
  pod 'GooglePlaces'
  pod 'GooglePlacesAPI'
  pod 'GooglePlacePicker'
  pod 'SwiftyJSON'
  pod 'Firebase/Core'
  pod 'Firebase/Storage'

  end

【问题讨论】:

  • 你能展示你的 podfile 吗?

标签: swift cocoapods


【解决方案1】:

将您的 podfile 文本替换为以下文本:

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

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


 # Pods for Taxi for rider

  pod 'Firebase'
  pod 'Firebase/Storage'
  pod 'Firebase/Auth'
  pod 'Firebase/Database'
  pod 'GoogleMaps'
  pod 'GoogleMaps'
  pod 'GooglePlaces'
  pod 'GooglePlacesAPI'
  pod 'GooglePlacePicker'
  pod 'SwiftyJSON'
  pod 'Firebase/Core'
  pod 'Firebase/Storage'
end

下面是代码中的错误行:

# Uncomment the next line to define a global platform for your    
project

应该是:

# Uncomment the next line to define a global platform for your project

而且你已经多次添加pod 'GoogleMaps'

【讨论】:

  • 非常感谢,是的,这很简单。我已取消注释,现在可以使用了
  • 如果可行,请不要忘记将其标记为正确。 @GermanPodorognik
【解决方案2】:

您应该在 Podfile 中为您的项目定义一个平台。将此附加到 Podfile 的开头:

platform :<ios, macos, tvos etc.>, '<version of the OS>'

例子:

platform :ios, '9.0'

【讨论】:

  • 是的,我确实做到了
  • 您没有取消注释该行。从它的开头删除#
【解决方案3】:

安装可可豆荚的步骤。

第 1 步 - 关闭您安装 pod 文件的 Xcode 项目。并打开终端。

第 2 步 - 输入 cd 命令并拖动您的项目路径。

第 3 步 - 按 Enter 并输入 pod init 命令然后打开您的项目文件夹,现在您可以看到 pod 文件

第 4 步 - 打开 pod 文件并写入您安装的 pod 名称

第 5 步 - 保存并关闭 pod 文件,然后再次打开终端并编写 pod install 命令并等待几分钟安装 pod

安装 pod 后,转到您的项目文件夹并打开 .work space 文件并享受。

现在 pod 已安装并使用。

【讨论】:

    猜你喜欢
    • 2015-10-22
    • 1970-01-01
    • 2015-10-23
    • 1970-01-01
    • 2021-09-01
    • 1970-01-01
    • 2016-07-11
    • 2014-12-10
    • 1970-01-01
    相关资源
    最近更新 更多