我试过用以下内容创建一个文件:
- 创建 Pod 文件
'
platform :osx, '10.0'
use_frameworks!
target 'MyApp' do
pod 'SwiftyJSON', '~> 2.2.0'
end
运行命令
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 文档。
这是我发现的
哦,看吧,也许它期待的不是“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/