swift - 如何在 OSX 上安装 SwiftyJSON

标签 swift cocoapods swifty-json

我试过用以下内容创建一个文件:

  1. 创建 Pod 文件

'

platform :osx, '10.0'
use_frameworks!

target 'MyApp' do
    pod 'SwiftyJSON', '~> 2.2.0'
end
  1. 运行命令

    pod安装

这是重新调整:

Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "SwiftyJSON":
  In Podfile:
    SwiftyJSON (~> 2.2.0)

Specs satisfying the `SwiftyJSON (~> 2.2.0)` dependency were found, but they required a higher minimum deployment target.

我认为这可能与平台有关,所以我转到 CoCaoPods.org 上的 SwiftJSON 文档。

这是我发现的

enter image description here

哦,看吧,也许它期待的不是“osx”,而是“macOS”。我将我的 Podfile 更新为:

platform :macOS, '10.0'
use_frameworks!

target 'Maconomi' do
    pod 'SwiftyJSON', '~> 2.2.0'
end

再次运行之前的命令并得到这个错误:

[!] Invalid `Podfile` file: Unsupported platform `macOS`. Platform must be `:ios`, `:osx`, `:tvos`, or `:watchos`..

 #  from /Users/travis.rivera/Documents/macOSAPP/Maconomi/Podfile:1
 #  -------------------------------------------
 >  platform :macOS, '10.0'
 #  use_frameworks!
 #  -------------------------------------------

所以现在我卡住了。

最佳答案

platform :osx, '10.10'
use_frameworks!

target 'MyApp' do
    pod 'SwiftyJSON', '~> 2.2.0'
end

然后

pod install

我错过了 osx 最低版本号。

关于swift - 如何在 OSX 上安装 SwiftyJSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52231002/

相关文章:

ios - Jenkins iOS 归档错误与 Pods FIRCoreDiagnostics.m 正常armv7

ios - 通过解析JSON创建Class对象数组- SwiftyJSON

ios - SwiftyJSON 字典解析

arrays - 如何根据行中的值对 Swift 中的二维数组列进行排序?

swift - 无效更新 : invalid number of items in section 0.

swift - 如何根据特定模型的值构建字典数组

ios - 如何在另一个脚本中调用 `pod` 或 'target'

ios - 如何从 POD 包含的库中删除警告

json - 接收顶层带有括号的格式错误的 JSON

objective-c - 如何在 Swift 中使用 Objective-C#define