OGeek|极客世界-中国程序员成长平台

标题: ios - Podfile 没有下载最新的 Swift 3 版本的 pod [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 12:13
标题: ios - Podfile 没有下载最新的 Swift 3 版本的 pod

自从更新到 Swift 3 后,我在安装 Swift 3 版本的 pod 时遇到了麻烦。例如,ReadabilityKit 在 master 分支上支持 Swift 3。在他们的自述文件中,他们声明要支持 Swift 3,您必须简单地执行以下操作:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
    pod 'ReadabilityKit'
end

我还包括以下行: source 'https://github.com/CocoaPods/Specs.git' 在 podfile 的顶部。

我看到的问题是,我在一个全新的 Swift 3 项目中复制了这个问题,当我执行 pod install 时,我得到了旧版本的 repo。因此,当在 Xcode 中打开项目时,它提供将 pod 的代码转换为 Swift 3,或者如果我构建它会引发一堆错误,因为它不在 Swift 3 中。我最终不得不像这样在 podfile 中列出它:

pod 'ReadabilityKit', :git => 'https://github.com/exyte/ReadabilityKit.git', :branch => 'master'`

这是默认设置 - 主分支上的常规 repo。但是直到现在,一旦我运行 pod install,它是否表明它已经升级了 pod,并且它可以正常工作。这不是 ReadabilityKit 独有的——它发生在我迄今为止尝试过的每个支持 Swift 3 的 Pod 上。

我在 Ruby 2.3.0 上使用 Cocoapods 1.0.1。



Best Answer-推荐答案


您可以尝试将此行添加到您的 podfile 的末尾:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

或者尝试将 cocoapods 更新到预发布版本:

sudo gem install cocoapods --pre

关于ios - Podfile 没有下载最新的 Swift 3 版本的 pod,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39805660/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4