Cocoapods – 无法find的规范

当试图在现有的Xcode(iOS)项目中pod install一个新的Podfile ,我从terminal得到以下错误信息: [!] Unable to find a specification for 'XCDYouTubeKit (~> 2.1.1)' 。 我试图加载的Podfile看起来像这样:

 # 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 

另外,我的Xcode项目的文件结构如下:

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

那么这个安装不起作用呢? 我哪里错了? 我正在运行Cocoapods 0.35.0 。 我是否缺less一个pod spec文件? 我不明白这是什么文件或什么文件结构的文件。

在注释中引用你的对话,你会想要执行sudo rm -fr ~/.cocoapods/repos/master因为它会删除你在计算机中所有的伪造和损坏的回购,给它一个机会来重新填充你重做pod setup ,这将重新用一个新的Cocoapods设置你。 另外,你需要指定sudo xcode-select --switch /applications/Xcode.app你的新版本的Xcode。 这只是我必须做的另一个安装程序来完成修复。 从那里,只要做pod setup ,你就可以运行pod install来集成你想要的所有库了!

你也可以通过设置它来强制它:

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

我有同样的问题。 但是我必须用下面的步骤来解决我的问题。

  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 

链接了解更多信息

我将把它放在这里供将来参考:在我的情况下,问题是一个错误的podspec与语法问题已被推送到远程。 Podfile包含对特定github提交的引用。 显然在这种情况下,CocoaPods给出了“缺少podspec”的相当无益的错误信息,尽管podspec绝对存在,只是拙劣的。

解决方案:下载podspec文件(例如,通过克隆整个吊舱的repo)并运行pod spec lint

或者:在本地克隆该Pod,并将Podfile引用更改为本地路径。 在这种情况下执行pod install将显示更多有用的错误消息。 喜欢这个:

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

正如你所看到的,在我的情况下,这是QuartzCore后的一个缺少的报价