Cocoapods: TypeError - no implicit conversion of nil into String

Created on 6 Jan 2017  ยท  17Comments  ยท  Source: CocoaPods/CocoaPods

Hi team,

I'm new to cocoapods. I'm trying to create a cocoapods library with pods name 'XXXXXLogging'
Getting the following error when I run 'pod install'

Analyzing dependencies

โ€•โ€•โ€• MARKDOWN TEMPLATE โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•

Command

/usr/local/bin/pod install

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.1.1
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
    RubyGems : 2.0.14.1
        Host : Mac OS X 10.12.2 (16C67)
       Xcode : 8.2.1 (8C1002)
         Git : git version 2.10.1 (Apple Git-78)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : xxxxx-kkkkkkk-xxxxxxxxlogging - https://github.xxxxx.com/kkkkk/xxxxxxxxxLogging.git @ 8d8799e951856b13ef8acd273c58eb0c8162c61c
               master - https://github.com/CocoaPods/Specs.git @ 02330d59dd94cb08b68b83d178daa20b9e05ccbb

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.1.1
cocoapods-try         : 1.1.0

Podfile

# Uncomment the next line to define a global platform for your project

source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.xxxxxxxx.com/kkkkkk/xxxxxxxxxLogging.git'
platform :ios, '9.0'

target 'xxxxxxLoggingSample' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  pod 'xxxxxxxxLogging'

  # Pods for xxxxxxxxLoggingSample

  target 'xxxxxxxxxLoggingSampleTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'xxxxxxxtLoggingSampleUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Error

TypeError - no implicit conversion of nil into String
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.1.1/lib/cocoapods-core/specification.rb:523:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.1.1/lib/cocoapods-core/specification.rb:523:in `new'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.1.1/lib/cocoapods-core/specification.rb:523:in `from_file'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.1.1/lib/cocoapods-core/specification/set.rb:45:in `specification'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.1.1/lib/cocoapods-core/source.rb:265:in `search'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.1.1/lib/cocoapods-core/source/aggregate.rb:83:in `block in search'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.1.1/lib/cocoapods-core/source/aggregate.rb:83:in `select'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.1.1/lib/cocoapods-core/source/aggregate.rb:83:in `search'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:347:in `create_set_from_sources'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:317:in `find_cached_set'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:290:in `specifications_for_dependency'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:108:in `search_for'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:206:in `block in sort_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:200:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:200:in `sort_by'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:200:in `sort_dependencies'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.3/lib/molinillo/delegates/specification_provider.rb:52:in `block in sort_dependencies'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.3/lib/molinillo/delegates/specification_provider.rb:69:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.3/lib/molinillo/delegates/specification_provider.rb:51:in `sort_dependencies'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.3/lib/molinillo/resolution.rb:165:in `initial_state'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.3/lib/molinillo/resolution.rb:106:in `start_resolution'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.3/lib/molinillo/resolution.rb:64:in `resolve'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.3/lib/molinillo/resolver.rb:42:in `resolve'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:62:in `resolve'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:723:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:721:in `resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:76:in `analyze'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:236:in `analyze'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:150:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:149:in `resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:110:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command/install.rb:37:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command.rb:50:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

โ€•โ€•โ€• TEMPLATE END โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•โ€•

Please help me in resolving the issue. I have seen multiple solutions posted for issue #5564 #6103 #3333. But none of them worked for me!! Please help.

Podsepc:
Pod::Spec.new do |s|
s.name = 'xxxxxxLogging'
s.version = '0.1.0'
s.summary = 'A short description of xxxxxxLogging.'
s.description = 'TODO:Add long description of the pod here.'
s.homepage = 'https://github.xxxxxxx.com/xxxxxxx/xxxxxxxxxxxxxLogging'
s.license = { :type => 'Proprietary' }
s.author = { 'Gowda, Karthik' => '[email protected]' }
s.source = { :git => 'https://github.xxxxxxx.com/xxxxxxx/xxxxxxxxxxxxxLogging.git', :tag => s.version }

s.platform = :ios
s.ios.deployment_target = '8.0'
s.source_files = 'xxxxxxxxLogging/*/.{swift,h}'
s.public_header_files = 'xxxxxxxLogging/Logging.h'
end

All 17 comments

Can you please paste your podspec?

Podspec:

Pod::Spec.new do |s|
s.name = 'xxxxxxLogging'
s.version = '0.1.0'
s.summary = 'A short description of xxxxxxLogging.'
s.description = 'TODO:Add long description of the pod here.'
s.homepage = 'https://github.xxxxxxx.com/xxxxxxx/xxxxxxxxxxxxxLogging'
s.license = { :type => 'Proprietary' }
s.author = { 'Gowda, Karthik' => '[email protected]' }
s.source = { :git => 'https://github.xxxxxxx.com/xxxxxxx/xxxxxxxxxxxxxLogging.git', :tag => s.version }

s.platform = :ios
s.ios.deployment_target = '8.0'
s.source_files = 'xxxxxxxxLogging/**/*.{swift,h}'
s.public_header_files = 'xxxxxxxLogging/Logging.h'
end

@KarthikGowda022 its very hard to test this without a sample project. Can you please provide one?

Same error happened to me when we moved pod from private repo to public one. Solved by removing private repo because I don't need it anymore, but it's not the solution of course ๐Ÿ˜„
Try to clear some caches or something like that maybe..?

Enter the directory of your.Podspec file
execute:
pod repo push [your private warehouse name] [your.Podspec file]
For example:
pod repo push LocalSpecs LocalSpecs.podspec

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

I'm facing the same problem but your solution didn't work with me still getting the same error podspec is valid if I removed the dependency I updated ruby and removed cocoa-pods and installed it again and did every expected solution people mentioned but still facing the same problem. any clues?
Here is everything about the problem:

I'm creating a private pod depending on another private pod the linter works well when I don't add any dependency but when I add the dependency and run the lint command it gives me that error
Encountered an unknown error (no implicit conversion of nil into String) during validation.
the lint command:
pod spec lint --private --sources=https://github.com/*****/****.git
Here is my podSpec

Pod::Spec.new do |s|

s.name         = "****Framework"
s.version      = "1.0.0"
s.summary      = "Summary  ................."
s.homepage     = "https://github.com/****/****Framework"
s.description  = "Description ................."
s.license      = "Simplified BSD license"
s.author       = { "Nahla Mortada" => "nahla.mortada@****.com" }
s.platform     = :ios, "9.0"
s.ios.deployment_target = "9.0"
s.source   = { :git => "https://github.com/****/****Framework.git", :tag => s.version }
s.source_files = "****Framework/*.swift"
s.pod_target_xcconfig =  {
'SWIFT_VERSION' => '3.0',
}
s.requires_arc = true
s.dependency '****'

end

I'm encountering the same problem (CocoaPods 1.2.1). The root cause was a private repo that had a directory for the desired pod, but no podspecs within the directory. Removing that directory caused the install to fail with a meaningful error message.

IMO this is a defect in the dependency resolver; it should handle that edge case gracefully and behave as if no revisions of the pod are in the repo.

Yep, there's an active PR for this issue: https://github.com/CocoaPods/Core/pull/405 - should be fixed in the next release

Hm, it's not clear that the PR repairs the root cause I've got (no specs in the directory for a Pod), and the unit tests don't seem to cover it either. I'm not at all familiar with this code, but it seems reasonable to have a test case ensuring things work if there's a directory with no podspecs inside. At my quick reading, the code seems to assume that if there's a directory, there's at least one version therein.

Ah, sure - fair enough, then you're welcome to take a look at either building on that PR, or making an independent one that covers the case ๐Ÿ‘

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

I ran into the empty directory issue described by @toddjonker at https://github.com/CocoaPods/CocoaPods/issues/6381#issuecomment-331292815 and it cost me a few hours this week. I'm going to make a PR to fix.

Thank you @paulb777 !

In case someone else comes across this in the future, if you are late to the cocoapods game, make sure you are using ruby > 2.3.1.

Was this page helpful?
0 / 5 - 0 ratings