Cocoapods的失败失败

时间:2016-11-16 14:42:21

标签: objective-c swift cocoapods lint

我有一个Objective-C库,我正在尝试将podspec更新为cocoapods。当我执行“pod spec lint”命令时,我收到以下错误:

[!] The spec did not pass validation, due to 1 error.
[!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a `.swift-version` file to set the version for your Pod. For example to use Swift 2.3, run: 
    `echo "2.3" > .swift-version`.

这是我的podspec文件:

Pod::Spec.new do |s|

  s.name         = "OSwitch"
  s.version      = "0.2.0"
  s.license      = { :type => "MIT", :file => "LICENSE" }
  s.summary      = "OSwitch is a customisable switch control writen in Objective C."
  s.homepage     = 'https://github.com/OyaSaid/OSwitch'
  s.source           = { :git => 'https://github.com/OyaSaid/OSwitch.git', :tag => s.version.to_s }
  s.platform     = :ios, "7.0"
  s.ios.frameworks = ['UIKit', 'Foundation']
  s.source_files = 'OSwitch/Classes/**/*.{h,m}'
  s.requires_arc = true
end

为什么在我有一个客观的C库时显示。我该如何解决这个问题?

由于

1 个答案:

答案 0 :(得分:2)

它表明,因为您可以在pod中同时使用swift和Objc语言。 只需在终端中运行以下命令:

    `echo "2.3" > .swift-version` 

将“2.3”替换为您在XCode中的当前Swift版本,如果您使用的是3.1,例如将其替换为“3.1”。它将在pod-project文件夹中创建一个swift版本文件。然后,您可以运行lint命令来验证podspec。