xcode Cocoapods - 无法找到 [Github 框架] 的规范
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28844013/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cocoapods - Unable to find a Specification for [Github framework]
提问by jamesharnett
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:
当尝试pod install
一个新的Podfile
到现有的Xcode(IOS)的项目,我从终端以下错误消息:[!] 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
Additionally, the file structure for my Xcode project is as follows:
此外,我的 Xcode 项目的文件结构如下:
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.
这个安装不工作怎么办?我哪里错了?我正在运行 Cocoapods 0.35.0
。我错过了一个pod spec
文件吗?我不明白它是什么或者这样一个文件的文件结构是什么。
回答by James Harnett
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!
在评论中引用您的对话,您会想要执行,sudo rm -fr ~/.cocoapods/repos/master
因为它会删除您计算机中的所有虚假和损坏的存储库,使其有机会在您重做后重新填充,这将使您pod setup
恢复使用新的 Cocoapods设置。此外,您需要指定sudo xcode-select --switch /applications/Xcode.app
新版本 Xcode 的位置。这只是我为完成修复而必须执行的另一个设置过程。从那里开始,pod setup
您就可以开始运行pod install
以集成您想要的所有库!
回答by nferocious76
You can also force it by setting it like this:
您也可以通过如下设置来强制它:
pod 'yourpodframework', :git => 'https://github.com/username/yourpodframework'
pod 'yourpodframework', :git => ' https://github.com/username/yourpodframework'
回答by Mohammad Razipour
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
回答by user3099609
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.
我将把它放在这里以供将来参考:在我的情况下,问题是一个错误的 podspec,其语法问题已被推送到远程。Podfile 包含对特定 github 提交的引用。显然在这种情况下 CocoaPods 给出了关于“缺少 podspec”的非常无用的错误消息,尽管 podspec 肯定存在,只是拙劣的。
Solution: download the podspec file (e.g. by cloning the entire pod's repo) and run pod spec lint
.
解决方案:下载 podspec 文件(例如通过克隆整个 pod 的 repo)并运行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:
或者:在本地克隆 pod,并将 Podfile 引用更改为本地路径。pod install
在这种情况下执行 a将显示更有用的错误消息。像这样:
[!] 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
正如你所看到的,在我的情况下,这是一个缺失的引用 QuartzCore