可可足类:错误 | [iOS] 未知:验证期间遇到未知错误 (Pod::DSLError)

Cocoapods: ERROR | [iOS] unknown: Encountered an unknown error (Pod::DSLError) during validation

我在 linting 规范或推送其 pod 时突然开始收到以下错误:

错误 | [iOS] 未知:验证期间遇到未知错误 (Pod::DSLError)。

最近对规范所做的唯一更改是版本升级(自上次运行良好以来)。这是完整的规格:

Pod::Spec.new do |s|

    s.version      = '2.0.0-alpha20'
    s.name         = 'RollbarCommon'
    s.summary      = 'Application/client side SDK for accessing the Rollbar API Server.'
    s.description  = <<-DESC
                      Find, fix, and resolve errors with Rollbar.
                      Easily send error data using Rollbar API.
                      Analyze, de-dupe, send alerts, and prepare the data for further analysis.
                      Search, sort, and prioritize via the Rollbar dashboard.
                   DESC
    s.homepage     = "https://rollbar.com"
    s.license      = { :type => "MIT", :file => "LICENSE" }
    s.documentation_url = "https://docs.rollbar.com/docs/ios"
    s.authors            = { "Andrey Kornich (Wide Spectrum Computing LLC)" => "akornich@gmail.com",
                              "Rollbar" => "support@rollbar.com" }
    s.social_media_url   = "http://twitter.com/rollbar"
    s.source             = { :git => "https://github.com/rollbar/rollbar-ios.git",
                              :tag => "v#{s.version}",
                              :submodules => true }
    s.resource = 'rollbar-logo.png'

    #  When using multiple platforms:
    s.ios.deployment_target = '9.0'
    s.osx.deployment_target = '10.10'
    s.tvos.deployment_target = '11.0'
    s.watchos.deployment_target = '4.0'

    s.source_files  = "#{s.name}/Sources/#{s.name}/**/*.{h,m}"
    s.public_header_files = "#{s.name}/Sources/#{s.name}/include/*.h"
    s.module_map = "#{s.name}/Sources/#{s.name}/include/module.modulemap"

    s.framework = "Foundation"
    
    s.requires_arc = true

end

知道哪里出了问题吗?

我刚刚找到这个错误的原因。在我的代码库中,我定义了多个 .pdspec 文件(每个 SDK 模块一个)。一些 podspecs 是完整的并且可以工作很长时间而没有任何变化(除了版本颠簸)。最近引入了其他 podspec,并且正在进行中。

当我尝试发布或检查完整的 podspec 时,出现了相关错误。然而,看起来(在深入研究错误日志中提到的 Ruby 脚本之后)Cocoapods 在特定 podspec 的 lint 和发布期间运行验证步骤。部分验证步骤遍历同一目录(或什至目录树 - ? )中的所有 .podspec 文件。所以,在我的例子中,它发现了不完整的 podspecs 并试图验证它们(为什么?)并且导致失败并出现错误。

该错误对解决问题以及报告的日志跟踪毫无帮助。找到一些有用提示的唯一方法是查看日志中提到的 Ruby 脚本行周围的代码块,并尝试对可能出错的地方进行逆向工程。

我只是想分享我的故事,并可能防止其他人 运行 陷入类似的错误(Google 搜索显示了很多这样的错误)并且在尝试解决问题时沮丧地浪费了几天它。