【问题标题】:Updating Alalmofire and SwiftyJSON for Swift 2为 Swift 2 更新 Alalmofire 和 SwiftyJSON
【发布时间】:2016-01-11 13:08:11
【问题描述】:

我是处理 pod 的新手,现在我正在尝试将 alamofire 更新到 alamofire 3.0 以及将 SwiftyJSON 更新到 2.3.0 以获得 Swift 2.0 支持 进入项目目录后:

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

pod 'Alamofire', '~> 3.0'
pod 'SwiftyJSON', '~> 2.3.0'

但我得到了这些错误:

-bash: https://github.com/CocoaPods/Specs.git: No such file or directory
Mes-iMac:MyProject.xcodeproj Me$ platform :ios, '8.0'
-bash: platform: command not found
Mes-iMac:MyProject.xcodeproj Me$ use_frameworks!
-bash: use_frameworks!: command not found
Mes-iMac:MyProject.xcodeproj Me$ 
Mes-iMac:MyProject.xcodeproj Me$ pod 'Alamofire', '~> 3.0'
[!] Unknown command: `Alamofire,`

[!] Unknown command: `SwiftyJSON,`

有什么帮助吗?谢谢

【问题讨论】:

  • 看起来你正试图执行你的 Podfile 文件,就好像它是一个可执行的 bash 文件一样......不要这样做!
  • @EricD。我该怎么办:(?
  • @Maha 你能写出你触发的命令吗?
  • 当您的 Podfile 完成后,您必须在终端中执行“pod install”,以便 Cocoapods 读取 Podfile 并在您的项目中安装组件。你应该阅读 Cocoapods 手册。

标签: ios xcode swift2 alamofire swifty-json


【解决方案1】:

您可以访问https://cocoapods.org/ 并找到您的图书馆。然后像这样复制链接:

在你的 Podfile 中使用 pod 'SwiftyJSON', '~> 2.3'pod 'Alamofire', '~> 3.1'

Podfile 将如下所示:

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'YourProjectName' do
    pod 'SwiftyJSON', '~> 2.3'
    pod 'Alamofire', '~> 3.1'
end

然后再次运行 pod install

【讨论】:

  • 如何在 podfile 中使用它们?
  • 非常感谢,但我应该在我的项目中 cd 到 podfile 吗?还是项目?我真的很困惑?
  • cd 到你的项目,然后按 ls 检查文件夹。如果是,则 pod install。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-04
  • 2014-12-27
  • 2015-09-11
  • 1970-01-01
相关资源
最近更新 更多