ios 无法在 CocoaPods 中找到规范
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25913733/
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
Unable to find a specification in CocoaPods
提问by Gaius Augustus
I cannot understand why the Cocoapod is unable to find the pod specification I created when I run pod install
. Could someone help me solve this trouble?
我不明白为什么 Cocoapod 在运行pod install
. 有人可以帮我解决这个麻烦吗?
I'm defining a subspec in my library podspec file like this:
我在我的库 podspec 文件中定义了一个子规范,如下所示:
s.subspec 'mysubspec' do |c|
c.dependency 'ABC','1.0.0'
end
This dependency ABC is listed in the library Podfile:
这个依赖 ABC 列在库 Podfile 中:
pod 'ABC', :git => '[email protected]:myrepo/Podspecs.git', :branch => 'xyz'
The Podspec file ABC.podspec
in the branch xyz of myrepo/Podspecs seems like this:
ABC.podspec
myrepo/Podspecs 分支 xyz 中的 Podspec 文件如下所示:
Pod::Spec.new do |s|
s.name = "ABC"
s.version = "1.0.0"
s.source = { :git => "[email protected]:myrepo/Podspecs.git", :branch => "xyz" }
end
The error is [!] Unable to find a specification for ABC (= 1.0.0)
错误是 [!] Unable to find a specification for ABC (= 1.0.0)
Solution:import the pod ABC before importing the subspec and add the tag to the podspec.
解决方法:在导入subspec之前先导入pod ABC,并在podspec中添加标签。
采纳答案by gran33
Instead of:
代替:
s.source = { :git => "[email protected]:myrepo/Podspecs.git", :branch => "xyz" }
Write this: Don't forget the tag...
写这个:不要忘记标签......
s.source = { :git => "https://github.com/myrepo/Podspecs.git", :branch => "xyz",
:tag => s.version.to_s }
回答by Gastón Antonio Montes
I suppose that there is a problem with your pod master repo. Delete it and download it again.
我想你的 pod master repo 有问题。删除它并重新下载。
You can do:
你可以做:
pod repo remove master
pod setup
pod install
Or:
或者:
sudo rm -fr ~/.cocoapods/repos/master
pod setup
pod install
回答by dloomb
For me it was an issue with finding the spec, not the spec itself. I needed to add a source link to the Podfile, see Podfile documentation
对我来说,找到规范是一个问题,而不是规范本身。我需要向 Podfile 添加源链接,请参阅Podfile 文档
Cocoapods recently added the need to link to the repo that holds the pod spec file you are looking for, the default is:
Cocoapods 最近添加了需要链接到包含您要查找的 pod 规范文件的 repo,默认为:
source 'https://github.com/CocoaPods/Specs.git'
You may need to add multiple source links if you are using more obscure or homemade pods.
如果您使用更晦涩或自制的 pod,您可能需要添加多个源链接。
回答by Hemang
With me, this worked like a charm.
对我来说,这就像一种魅力。
pod repo remove master
pod setup
However, you may try directly, pod setup
as some users pointed.
但是,您可以直接尝试,pod setup
正如一些用户所指出的那样。
回答by zippo
I resolve this after add
添加后我解决了这个问题
source '/Users/username/Documents/path/to/iOS_SpecsRepository'
source 'https://github.com/CocoaPods/Specs.git'
to Podfile. well .I used a local repository as my Repo. So i can user this in another podspec file
到 Podfile。好吧。我使用本地存储库作为我的 Repo。所以我可以在另一个 podspec 文件中使用它
s.dependency 'iOS_Networking_CPN', '~> 0.1.1'
iOS_Networking_CPN
is in the local path.
iOS_Networking_CPN
位于本地路径中。
回答by Ugo Marinelli
Make sure you added
确保你添加了
source 'https://github.com/CocoaPods/Specs.git'
at the very beginning of your Podfile
在 Podfile 的最开始
回答by Idan Magled
Update the master repo for cocoapods.
更新 cocoapods 的主仓库。
`pod repo update master`
回答by zeeawan
I was getting similar error for MGBoxkit
我在MGBoxkit 中遇到了类似的错误
[!] Unable to find a specification for
MGBoxkit
[!] 无法找到规范
MGBoxkit
By replacing the following line
通过替换以下行
pod 'MGBoxkit'
with
和
pod 'MGBoxKit'
fixed the issue.
解决了这个问题。
回答by Jevon Charles
You first need to add your Podspec to a private specs repo; this lets CocoaPods find the pod when you try to install it.
您首先需要将您的 Podspec 添加到私有规范存储库中;这让 CocoaPods 在您尝试安装时找到 pod。
Enter the following in Terminal, making sure you're still in the framework directory you are trying to add:
在终端中输入以下内容,确保您仍在尝试添加的框架目录中:
pod repo add [your framework name] [Your framework Git URL]
pod repo push [your framework name] [your framework .podspec file name]
回答by Sunil Targe
Follow the below steps :
请按照以下步骤操作:
Step 0:pod repo update master
第 0 步:pod repo update master
Step 1:pod install
第1步:pod install
And you are done!
你已经完成了!