无法在可可豆中找到规格

时间:2022-09-13 17:30:32

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安装时创建的pod规范。有人能帮我解决这个问题吗?

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被列在图书馆的播客文件中:

pod 'ABC', :git => 'git@github.com:myrepo/Podspecs.git', :branch => 'xyz'

The Podspec file ABC.podspec in the branch xyz of myrepo/Podspecs seems like this:

ABC的Podspec文件。myrepo/ podspec分支中的podspec看起来是这样的:

Pod::Spec.new do |s|
  s.name         = "ABC"
  s.version      = "1.0.0"
  s.source       = { :git => "git@github.com:myrepo/Podspecs.git", :branch => "xyz" }
end

The error is [!] Unable to find a specification for ABC (= 1.0.0)

错误的!无法找到ABC的规范(= 1.0.0)

Solution: import the pod ABC before importing the subspec and add the tag to the podspec.

解决方案:在导入子规范之前导入pod ABC,并将标记添加到podspec。

12 个解决方案

#1


11  

Instead of:

而不是:

s.source       = { :git => "git@github.com: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 }

#2


126  

I suppose that there is a problem with your pod master repo. Delete it and download it again.

我想你们的舱长repo有问题。删除它,再下载一次。

You can do:

你能做什么:

pod repo remove master
pod setup
pod install

Or:

或者:

sudo rm -fr ~/.cocoapods/repos/master
pod setup
pod install

#3


19  

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.

如果您使用的是比较模糊或自制的豆荚,您可能需要添加多个源链接。

#4


4  

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.

固定的问题。

#5


3  

I resolve this after add

我在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。我用本地存储库作为我的回购。我可以在另一个podspec文件中使用这个

s.dependency 'iOS_Networking_CPN', '~> 0.1.1'

iOS_Networking_CPN is in the local path.

iOS_Networking_CPN在本地路径中。

#6


3  

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设置。

#7


2  

Make sure you added

确保你添加

source 'https://github.com/CocoaPods/Specs.git'

at the very beginning of your Podfile

在播客的一开始

#8


2  

In my case I just update my cocoapods.

就我而言,我只是更新我的茧。

repo update master

#9


1  

I solved my problem with below command:

我用下面的命令解决了我的问题:

cocoa pod update

可可豆荚更新

To update use this command

要更新,请使用此命令

sudo gem install cocoapods

sudo gem安装cocoapods

if above command gives error than use this one

如果上面的命令出现错误,则使用这个命令

sudo gem install -n /usr/local/bin cocoapods

sudo gem安装-n /usr/local/bin cocoapods

and than do this

比这个

pod repo update

豆荚回购更新

#10


0  

I missed adding , causing issue.

我漏加了,引起了问题。

Replacing,

更换,

pod 'PodName' '~> 2.3'

With,

与,

pod 'PodName', '~> 2.3'

Did the job.

做这份工作。

#11


0  

had the same problem.

有同样的问题。

what really worked for me was gem uninstall cocoapods (as mentioned above by https://*.com/users/4264880/seema-sharma) where I found that I had 11 (!) different cocoapods versions installed.

真正对我有用的是gem uninstall cocoapods(如上所述,https://*.com/users/4264880/seema-sharma),我发现我安装了11个(!)不同的cocoapods版本。

I chose to uninstall all and then gem install cocoapods:1.4.0

我选择卸载所有,然后gem安装cocoapods:1.4.0

All good now.

现在都好。

#12


0  

For me, the below worked well but first try could be direct "pod setup" command If that don't work then go for the below commands would definitely make things happen.

对于我来说,下面的命令运行得很好,但是首先尝试使用直接的“pod setup”命令,如果这样不行,那么下面的命令肯定会让事情发生。

pod repo remove master
pod setup
pod install

拆卸主吊舱安装吊舱

#1


11  

Instead of:

而不是:

s.source       = { :git => "git@github.com: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 }

#2


126  

I suppose that there is a problem with your pod master repo. Delete it and download it again.

我想你们的舱长repo有问题。删除它,再下载一次。

You can do:

你能做什么:

pod repo remove master
pod setup
pod install

Or:

或者:

sudo rm -fr ~/.cocoapods/repos/master
pod setup
pod install

#3


19  

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.

如果您使用的是比较模糊或自制的豆荚,您可能需要添加多个源链接。

#4


4  

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.

固定的问题。

#5


3  

I resolve this after add

我在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。我用本地存储库作为我的回购。我可以在另一个podspec文件中使用这个

s.dependency 'iOS_Networking_CPN', '~> 0.1.1'

iOS_Networking_CPN is in the local path.

iOS_Networking_CPN在本地路径中。

#6


3  

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设置。

#7


2  

Make sure you added

确保你添加

source 'https://github.com/CocoaPods/Specs.git'

at the very beginning of your Podfile

在播客的一开始

#8


2  

In my case I just update my cocoapods.

就我而言,我只是更新我的茧。

repo update master

#9


1  

I solved my problem with below command:

我用下面的命令解决了我的问题:

cocoa pod update

可可豆荚更新

To update use this command

要更新,请使用此命令

sudo gem install cocoapods

sudo gem安装cocoapods

if above command gives error than use this one

如果上面的命令出现错误,则使用这个命令

sudo gem install -n /usr/local/bin cocoapods

sudo gem安装-n /usr/local/bin cocoapods

and than do this

比这个

pod repo update

豆荚回购更新

#10


0  

I missed adding , causing issue.

我漏加了,引起了问题。

Replacing,

更换,

pod 'PodName' '~> 2.3'

With,

与,

pod 'PodName', '~> 2.3'

Did the job.

做这份工作。

#11


0  

had the same problem.

有同样的问题。

what really worked for me was gem uninstall cocoapods (as mentioned above by https://*.com/users/4264880/seema-sharma) where I found that I had 11 (!) different cocoapods versions installed.

真正对我有用的是gem uninstall cocoapods(如上所述,https://*.com/users/4264880/seema-sharma),我发现我安装了11个(!)不同的cocoapods版本。

I chose to uninstall all and then gem install cocoapods:1.4.0

我选择卸载所有,然后gem安装cocoapods:1.4.0

All good now.

现在都好。

#12


0  

For me, the below worked well but first try could be direct "pod setup" command If that don't work then go for the below commands would definitely make things happen.

对于我来说,下面的命令运行得很好,但是首先尝试使用直接的“pod setup”命令,如果这样不行,那么下面的命令肯定会让事情发生。

pod repo remove master
pod setup
pod install

拆卸主吊舱安装吊舱