Search code examples
cocoapods

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


I suddenly started getting the following error when linting spec or pushing its pod:

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

The only recent change that was done to the spec is a version bump (since the last time it worked fine). Here is the full spec:

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)" => "[email protected]",
                              "Rollbar" => "[email protected]" }
    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

Any idea regarding what could be wrong?


Solution

  • I just found the reason for this error. In my codebase, I have multiple .pdspec files defined (one per each SDK module). Some of the podspecs were complete and worked for a long time with no changes (except the version bumps). Other podspecs were introduced recently and are work-in-progress.

    The error in question was happening while I was trying to either publish or lint the complete podspecs. However, as it appears (after digging into the Ruby scripts mentioned with the error log) that Cocoapods runs the validation step during both lint and publishing of a specific podspec. Part of the validation steps iterates through all .podspec files within the same directory (or maybe even directory tree - ? ). So, in my case, it was discovering the incomplete podspecs and trying to validate them as well (WHY?) and of cause failing with the error.

    The error is not helpful at all to troubleshoot the problem as well as log traces reported with it. The only way to find out some helpful hints was to look into code blocks around the Ruby script-lines mentioned in the log and try to reverse engineer what possibly was going on wrong.

    I just wanted to share my story and to possibly prevent other people from running into a similar error (a Google search shows a lot of those) and losing days in frustration trying to troubleshoot it.