11

When trying to pod install a new Podfile into an existing Xcode (iOS) project, I get the following error message from Terminal: [!] Unable to find a specification for 'XCDYouTubeKit (~> 2.1.1)'. The Podfile that I was trying to load looks like this:

# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'

target 'DemoApp' do

pod 'XCDYouTubeKit', '~> 2.1.1'

end

target 'DemoAppTests' do

end

target 'TheDayByDay' do

end

Additionally, the file structure for my Xcode project is as follows:

DemoApp
     Podfile (file)
     Pods (directory)
     DemoApp (directory)
     DemoApp.xcodeproj (file)
     DemoAppTests (directory)

What about this installation is not working? Where am I going wrong? I'm running Cocoapods 0.35.0. Am I missing a pod spec file? I don't understand what it is or what the file structure of such a file would like.

  • 2
    Can you try running `pod repo update` and see if this error goes away? Otherwise remove `~/.cocoapods` and then run `pod setup` – Keith Smiley Mar 04 '15 at 01:12
  • @KeithSmiley `pod repo update` didn't work, but why should I remove `~/.cocoapods`? Isn't that the entire cocoa pods installation library? How would that help? –  Mar 07 '15 at 20:08
  • @KeithSmiley pod repo update actually worked for me. It updated tons of other repos in my computer, can you explain why this would work? – code4latte Jan 09 '17 at 18:19

4 Answers4

33

Citing your conversation in the comments, you'll want to execute sudo rm -fr ~/.cocoapods/repos/master because it'll remove all the bogus and corrupted repos that you have in your computer to give it a chance to repopulate after you redo pod setup, which'll reinstate you with a fresh Cocoapods setup. Additionally, you'll want to specify sudo xcode-select --switch /applications/Xcode.app where your new version of Xcode is. That was just another setup procedure that I had to do to complete the fix. From there, just do pod setup and you're set to run pod install to integrate all the libraries that you want!

5

You can also force it by setting it like this:

pod 'yourpodframework', :git => 'https://github.com/username/yourpodframework'

eNeF
  • 3,241
  • 2
  • 18
  • 41
  • Why we require to add source path to get pod works, what could be the reason of some pods works just by - pod 'podname' and some requires additional way as above. – Kiran Jasvanee Mar 09 '17 at 11:48
  • this is because pods that requires only the podname is deployed in public podspec repo and the other is deployed in private podspec repo. so you need to specify the path. – eNeF Mar 09 '17 at 12:31
  • Can you provide any link for the reference how we can configure it. I've uploaded my github library and I specified full path to get it worked. – Kiran Jasvanee Mar 09 '17 at 12:41
4

I had the same problem. But I've got to fix my issue with the following procedure.

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

    target 'Test' do

      use_frameworks!

#    pod 'Alamofire', '~> 4.0'
     pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'

#    pod 'SwiftyJSON' , '~> 3.1'
     pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'

#     pod 'SideMenu' '~> 2.0'
      pod 'SideMenu', :git => 'https://github.com/jonkykong/SideMenu.git'

#     pod 'SDWebImage', '4.0.0-beta2'
      pod 'SDWebImage', :git => 'https://github.com/rs/SDWebImage.git'

#     pod 'SwiftDate', '~> 4.0'
      pod 'SwiftDate', :git => 'https://github.com/malcommac/SwiftDate'



end

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

Links for more information

Mohammad Razipour
  • 3,643
  • 3
  • 29
  • 49
  • This fixed it for me, thanks!! I am unclear why it is hit or miss though. Some work fine with just the line that you have commented out, and others require the git reference. – Scooter Jan 29 '17 at 18:50
1

I'll put this here for future reference: In my case the problem was a faulty podspec with a syntax issue that had been pushed to a remote. The Podfile contained a reference to a specific github commit. Apparently in this situation CocoaPods give the quite unhelpful error message about "missing podspec" although the podspec is definitely there, only botched.

Solution: download the podspec file (e.g. by cloning the entire pod's repo) and run pod spec lint.

Alternatively: clone the pod locally and change the Podfile reference to a local path. Doing a pod install in this case will show a much more helpful error message. Like this:

[!] Invalid `<some>.podspec` file: syntax error, unexpected tCONSTANT, expecting keyword_end
...eGraphics', 'QuartzCore, 'IOKit', 'XCTest'

As you can see, in my case this was a missing quote after QuartzCore

user3099609
  • 2,318
  • 18
  • 20