简体   繁体   English

在 CocoaPods 中找不到规范

[英]Unable to find a specification in CocoaPods

I cannot understand why the Cocoapod is unable to find the pod specification I created when I run pod install .我不明白为什么 Cocoapod 找不到我在运行pod install时创建的 pod 规范。 Could someone help me solve this trouble?有人可以帮我解决这个问题吗?

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 => 'git@github.com:myrepo/Podspecs.git', :branch => 'xyz'

The Podspec file ABC.podspec in the branch xyz of myrepo/Podspecs seems like this: myrepo/Podspecs 的 xyz 分支中的 Podspec 文件ABC.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)错误是[.] Unable to find a specification for ABC (= 1.0.0)

I suppose that there is a problem with your pod master repo.我想你的 pod master repo 有问题。 Delete it and download it again.删除它并重新下载。

You can do:你可以做:

pod repo remove master
pod setup
pod install

Or:要么:

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

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,您可能需要添加多个源链接。

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 }

Make sure you added确保你添加了

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

at the very beginning of your Podfile在 Podfile 的最开始

I resolve this after add添加后我解决了这个问题

source '/Users/username/Documents/path/to/iOS_SpecsRepository'
source 'https://github.com/CocoaPods/Specs.git'

to Podfile.到 Podfile。 well .I used a local repository as my Repo.嗯。我使用本地存储库作为我的 Repo。 So i can user this in another podspec file所以我可以在另一个 podspec 文件中使用它

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

iOS_Networking_CPN is in the local path. iOS_Networking_CPN在本地路径中。

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

更新 cocoapods 的主仓库。

pod repo update master

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.解决了这个问题。

You first need to add your Podspec to a private specs repo;您首先需要将您的 Podspec 添加到私有规范存储库中; this lets CocoaPods find the pod when you try to install it.这让 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]

I missed adding , causing issue.我错过了添加,导致问题。

Replacing,更换,

pod 'PodName' '~> 2.3'

With,和,

pod 'PodName', '~> 2.3'

Did the job.做了工作。

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 install -n /usr/local/bin cocoapods

and than do this而不是这样做

pod repo update pod 回购更新

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 repo 移除 master
pod setup吊舱设置
pod install吊舱安装

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!你已经完成了!

had the same problem.有同样的问题。

what really worked for me was gem uninstall cocoapods (as mentioned above by https://stackoverflow.com/users/4264880/seema-sharma ) where I found that I had 11 (!) different cocoapods versions installed.真正对我有用的是gem uninstall cocoapods (如上文https://stackoverflow.com/users/4264880/seema-sharma 所述),我发现我安装了 11 个(!)不同的 cocoapods 版本。

I chose to uninstall all and then gem install cocoapods:1.4.0我选择卸载所有然后gem install cocoapods:1.4.0

All good now.现在一切都很好。

use tis instead.使用 tis 代替。 Using private pod and public pod in the same project 在同一个项目中使用私有 Pod 和公共 Pod

add the souce for both private and public(official) in the beginning of the podfile.在 podfile 的开头添加私有和公共(官方)的源。

None of the answers helped me.没有一个答案对我有帮助。 Ultimately i figured out that I had a typo spelling mistake for one of the Pods .最终我发现我有一个Pods 的拼写错误

Ex:- Firebaseresulrereres/Analytics .例如:- Firebaseresulrereres/Analytics It was supposed to be Firebase/Analytics but without my knowledge the pod name had a wrong spelling like Firebaseresulrereres/Analytics .它应该是Firebase/Analytics但在我不知道的情况下,pod 名称的拼写错误,如Firebaseresulrereres/Analytics

Correcting the Pod Name did the trick for me!更正 Pod 名称对我有用! . . It cost me 1 hour to find this though!.我花了 1 个小时才找到这个! Development can be ambiguous and frustrating some times!开发有时可能会模棱两可且令人沮丧! :) :)

I was working in flutter with all public repos.我正在与所有公共存储库一起工作。 I was getting a similar error:我收到了类似的错误:

Unable to find a specification for `TOCropViewController (~> 2.5.2)` depended upon by `image_cropper`

For some reason TOCropViewController specification was unavailable.由于某种原因TOCropViewController规范不可用。 I tried the following:我尝试了以下方法:

flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm ios/Podfile
flutter run

But the plugin specification was still unavailable.但是插件规范仍然不可用。 Finally, I solved it by removing the pod's repo master.最后,我通过删除 pod 的 repo master 来解决它。

pod repo remove master
sudo rm -rf ~/.cocoapods/repos
pod setup
pod install

To validate and confirm that the plugin is here, I tried grep inside .cocoapods , using:为了验证和确认插件在这里,我在.cocoapods尝试了grep ,使用:

 grep -r "TOCropViewController" -n ~/.cocoapods

Inside ~/.cocoapods/repos/trunk/Specs/3/7/4/TOCropViewController/2.5.2/TOCropViewController.podspec.json里面~/.cocoapods/repos/trunk/Specs/3/7/4/TOCropViewController/2.5.2/TOCropViewController.podspec.json

I found the plugin's git repo and correct version number.我找到了插件的 git repo 和正确的版本号。

  "source": {
    "git": "https://github.com/TimOliver/TOCropViewController.git",
    "tag": "2.5.2"
  },

After that flutter clean and flutter run started working.在那之后flutter cleanflutter run开始工作。

pod update

在我的情况下解决了同样的错误。

I had to add these two lines at the beginning of the Podfile:我不得不在 Podfile 的开头添加这两行:

 source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/goinstant/pods-specs-public'

Then run pod install again.然后再次运行pod install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM