ios Cocoapods:无法找到 [PrivateClientSpec] 依赖的 [PrivateSpec] 的规范

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27303475/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 03:54:13  来源:igfitidea点击:

Cocoapods: Unable to find a specification for [PrivateSpec] depended upon by [PrivateClientSpec]

iosxcodecocoapods

提问by Chris Conover

I am trying to use private repositories to break up a larger application. I have followed the guides at:

我正在尝试使用私有存储库来分解更大的应用程序。我遵循了以下指南:

I have created a local repository to contain the specs, published to cocoapods via

我创建了一个本地存储库来包含规范,通过发布到 cocoapods

pod remote add MySpecs ~/local/path/to/MySpecs.git,

pod remote add MySpecs ~/local/path/to/MySpecs.git,

verified that cocoapods sees them by looking at the contents of ~/.cocoapods/repos/MySpecs

通过查看内容来验证 cocoapods 可以看到它们 ~/.cocoapods/repos/MySpecs

I have referenced PrivateSpecwithin PrivateClientSpecas follows:

我曾经引用PrivateSpecPrivateClientSpec,如下所示:

s.dependency 'PrivateSpec' '~> 0.1.0'

s.dependency 'PrivateSpec' '~> 0.1.0'

The problem is that when I try to lint this PrivateClientSpec, I get the titular error:

问题是,当我尝试 lint this 时PrivateClientSpec,出现了名义错误:

Unable to find a specification for [PrivateSpec] depended upon by [PrivateClientSpec]

Unable to find a specification for [PrivateSpec] depended upon by [PrivateClientSpec]

Am I missing something? From what I understand, this is supported behavior. I am using cocoapods v0.35.

我错过了什么吗?据我了解,这是受支持的行为。我正在使用 cocoapods v0.35。

Thanks!

谢谢!

回答by mokagio

The reason is that the pod speclinter is only checking the master specs, so it can't find your private one.

原因是pod speclinter 只检查主规格,所以它找不到你的私人规格。

You'll need to use the --sourcesoption, like this:

您需要使用该--sources选项,如下所示:

pod spec lint --sources='git@our-private-spec-repo:iOS/Specs.git,https://github.com/CocoaPods/Specs'

Two things two note:

两件事要注意:

  • Your private specs need to be online, can't check on a local one
  • If you depend on other pods you'll need to add the URL for their Spec repo too, that's why in the example we have https://github.com/CocoaPods/Specstoo.
  • 您的私人规格需要在线,无法查看本地规格
  • 如果您依赖其他 pod,您也需要为其 Spec 存储库添加 URL,这就是为什么在示例中我们也有https://github.com/CocoaPods/Specs

By running pod spec lint --helpyou can read more about this option:

通过运行,pod spec lint --help您可以阅读有关此选项的更多信息:

--sources=https://github.com/artsy/Specs   The sources from which to pull
                                           dependant pods (defaults to
                                           https://github.com/CocoaPods/Specs.git).
                                           Multiple sources must be
                                           comma-delimited.

More on this hereand here

更多关于这里这里

回答by ElonChan

In order for pod installto work properly I still had to add:

为了pod install正常工作,我仍然必须添加:

source '<Prive specs lib URL>'
source 'https://github.com/CocoaPods/Specs.git'

..to the pod file (not podspec).

..到 pod 文件(不是 podspec)。

To get rid of:

摆脱:

Unable to find a specification for [PrivateSpec] depended upon by [PrivateClientSpec]

无法找到 [PrivateClientSpec] 依赖的 [PrivateSpec] 的规范

Then If you also failed to install with error like this

那么如果您也安装失败并出现这样的错误

pod install --verbose

  Preparing

Re-creating CocoaPods due to major version update.
  - Running source provider hooks
https://github.com/CocoaPods/Specs.git
<Prive specs lib URL>
source_url <Prive specs lib URL>

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-YourTarget`: (``)

Finding Podfile changes
  XXXXXXXXXXXXXXX

Resolving dependencies of `Podfile`

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command

```
/usr/local/bin/pod install --verbose
```

### Report

* What did you do?

* What did you expect to happen?

* What happened instead?


### Stack

```
   CocoaPods : 1.1.1
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
    RubyGems : 2.6.10
        Host : Mac OS X 10.12.4 (16E195)
       Xcode : 8.3.2 (8E2002)
         Git : git version 2.11.0 (Apple Git-81)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : alibaba-specs -  @ fatal: Not a git repository (or any of the parent directories): .git
               aliyun - [email protected]:aliyun/aliyun-specs.git @ 7406176b51b4d4f8f323a39f4d96a3857229805d
               aliyun-1 - <Prive specs lib URL> @ 7406176b51b4d4f8f323a39f4d96a3857229805d
               master - https://github.com/CocoaPods/Specs.git @ 86c330635113e7fc290fdebad4ba3ed0dca2daee
               taobao-baichuansdk-alibcspecs - http://repo.baichuan-ios.taobao.com/baichuanSDK/AliBCSpecs.git @ e8cb2ae2ee7f44582923e4fae29243d6225fa8ee
```

### Plugins

```
cocoapods-deintegrate   : 1.0.1
cocoapods-plugins       : 1.0.0
cocoapods-repo-alirsync : 1.0.4
cocoapods-repo-rsync    : 1.0.4
cocoapods-search        : 1.0.0
cocoapods-stats         : 1.0.0
cocoapods-trunk         : 1.2.0
cocoapods-try           : 1.1.0
```

### Podfile

```ruby
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!


source 'https://github.com/CocoaPods/Specs.git'
source '<Prive specs lib URL>'


target 'YourTarget' do
  pod 'AlicloudFeedback', ‘~> 3.0.1'
end
```

### Error

```
RuntimeError - Cannot initialize an aggregate with a nil source: ([nil])
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.1.1/lib/cocoapods-core/source/aggregate.rb:13:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:356:in `new'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:356:in `aggregate_for_dependency'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:347:in `create_set_from_sources'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:317:in `find_cached_set'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:290:in `specifications_for_dependency'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:108:in `search_for'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:206:in `block in sort_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:200:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:200:in `sort_by'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:200:in `sort_dependencies'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.7/lib/molinillo/delegates/specification_provider.rb:52:in `block in sort_dependencies'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.7/lib/molinillo/delegates/specification_provider.rb:69:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.7/lib/molinillo/delegates/specification_provider.rb:51:in `sort_dependencies'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.7/lib/molinillo/resolution.rb:165:in `initial_state'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.7/lib/molinillo/resolution.rb:106:in `start_resolution'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.7/lib/molinillo/resolution.rb:64:in `resolve'
/Library/Ruby/Gems/2.0.0/gems/molinillo-0.5.7/lib/molinillo/resolver.rb:42:in `resolve'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/resolver.rb:62:in `resolve'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:723:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:721:in `resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:76:in `analyze'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:236:in `analyze'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:150:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:149:in `resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:110:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command/install.rb:37:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command.rb:50:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
```

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=Cannot+initialize+an+aggregate+with+a+nil+source%3A+%28%5Bnil%5D%29&type=Issues

If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...
 - Changes search index format to fasten `pod search --full` command.
   https://github.com/CocoaPods/CocoaPods/pull/4249 [closed] [33 comments]
   28 Oct 2015


[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.

Then you should try to update your CocoaPods version. This may help you: https://stackoverflow.com/a/39973232/3395008

那么你应该尝试更新你的 CocoaPods 版本。这可能对您有所帮助:https: //stackoverflow.com/a/39973232/3395008

回答by hbosamia

In case mokagio's answer doesn't work for anyone, here is what worked for me:

万一 mokagio 的答案对任何人都不起作用,以下是对我有用的方法:

Just change private repo url to https://

只需将私人回购网址更改为 https://

pod spec lint --sources='https://our-private-spec-repo:iOS/Specs.git,https://github.com/CocoaPods/Specs'

回答by Menno

In order for pod installto work properly I still had to add:

为了pod install正常工作,我仍然必须添加:

source '<Prive specs lib URL>'
source 'https://github.com/CocoaPods/Specs.git'

..to the pod file (not podspec).

..到 pod 文件(不是 podspec)。

To get rid of:

摆脱:

Unable to find a specification for [PrivateSpec] depended upon by [PrivateClientSpec]

无法找到 [PrivateClientSpec] 依赖的 [PrivateSpec] 的规范