【问题标题】:Cocoapod swifty json issueCocoapod swifty json问题
【发布时间】:2015-07-28 19:55:31
【问题描述】:

我在项目的依赖管理方面遇到了一些困难。我目前已经成功地让 Alamofire 工作,现在我希望在我的项目中添加一个新的依赖项。

按照此处的指南 - https://github.com/SwiftyJSON/SwiftyJSON 它告诉我将以下内容添加到我的 pod 文件中

platform :ios, '8.0'
use_frameworks!

target 'Relocate' do
    pod 'SwiftyJSON', '~> 2.2.1'
end

这意味着我的 pod 文件现在如下所示;

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Alamofire', '~> 1.3'

platform :ios, '8.0'
use_frameworks!

target 'Relocate' do
    pod 'SwiftyJSON', '~> 2.2.1'
end

问题是,当我运行pod install 命令时,出现以下错误

Rickis-iMac:Relocate rickilambert$ pod install
Updating local specs repositories
Analyzing dependencies
[!] Unable to satisfy the following requirements:

- `SwiftyJSON (~> 2.2.1)` required by `Podfile`

有谁知道我该如何解决这个问题?

谢谢

【问题讨论】:

    标签: swift cocoapods dependency-management swifty-json


    【解决方案1】:

    我的 Podfiles 完全像下面这样,从来没有遇到过问题。尝试将其粘贴并运行pod install

    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '8.0'
    use_frameworks!
    
    pod 'Alamofire', '~> 1.3'
    pod 'SwiftyJSON', '~> 2.2.1'
    

    【讨论】:

      【解决方案2】:

      使用 2.2.0 版有效 - 请注意,不知道 2.2.1 版有什么问题。

      【讨论】:

      • 你的问题应该是 CocoaPods 的 spec repo 的问题
      【解决方案3】:

      首先,您必须删除 SwiftyJSON V 2.2.1(从您的项目中)。通过使用以下 podfile 运行 pod install:

      platform :ios, "8.0"
      use_frameworks!
      
      target 'AppName' do
      pod 'Alamofire', '~> 1.3'
      end
      
      target 'AppNameTests' do
      
      end
      

      然后您必须将 SwiftyJSON V 2.2.0 添加到您的 podfile 中,然后再次运行 pod install:

      platform :ios, "8.0"
      use_frameworks!
      
      target 'AppName' do
      pod 'Alamofire', '~> 1.3'
      pod 'SwiftyJSON', '~> 2.2.0'
      end
      
      target 'AppNameTests' do
      
      end
      

      我希望这会有所帮助,编码快乐。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-07-27
        • 2015-07-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-12-21
        相关资源
        最近更新 更多