"Your project does not explicitly specify the CocoaPods master specs repo" 在 运行 pod 安装时发出警告

"Your project does not explicitly specify the CocoaPods master specs repo" warning when running pod install

在我 运行 pod install 之后,我收到一条警告说:

[!] Your project does not explicitly specify the CocoaPods master specs repo. Since CDN is now used as the default, you may safely remove it from your repos directory via pod repo remove master.

To suppress this warning please add warn_for_unused_master_specs_repo => false to your Podfile.

为什么我会收到此警告?以前,我能够 运行 pod install 而没有任何警告。

如果有帮助,这里还有另一个细节:我无法使用 sudo gem install 到 install/upgrade CocoaPods,所以我改用了这个命令:

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

运行命令pod repo remove master

但是,如果您不想删除主存储库,只需将 warn_for_unused_master_specs_repo 设置添加到您的 Podfile 中,更改以下内容即可使警告静音:

install! 'cocoapods'

对此:

install! 'cocoapods', :warn_for_unused_master_specs_repo => false

如果您在 install! 'cocoapods' 之后已有选项,请在新设置后附加一个逗号:

install! 'cocoapods', :deterministic_uuids => false, :warn_for_unused_master_specs_repo => false

它有删除 git 存储库并使 trunk 默认存储库的关系 to this change 我已经通过列出存储库 pod repo list 然后删除 master 使用命令解决了这个问题pod repo remove只留下后备箱

当 运行 'pod repo remove master' 我受到欢迎时:

[!] repo master does not exist

我做了一个....

pod repo list

cocoapods
- Type: git (master)
- URL:  https://github.com/CocoaPods/Specs.git
- Path: /Users/plasma/.cocoapods/repos/cocoapods

trunk
- Type: CDN
- URL:  https://cdn.cocoapods.org/
- Path: /Users/plasma/.cocoapods/repos/trunk

注意到 'master' 实际上叫做 'cocoapods' 所以我做了一个..

pod repo remove cocoapods

我已经完成的更新和安装没有任何错误。

您现在应该使用 CocoaPods CDN 作为默认来源:

source 'https://cdn.cocoapods.org/'

如果是这样,您可以使用建议的命令 pod repo remove master.

安全地从您的计算机中删除主存储库

原答案

我通过在我的 Podfile 顶部添加 source 解决了这个警告:

source 'https://github.com/CocoaPods/Specs.git'
# pod version > 1.7.2
# Step 1
pod repo list

# pod repo list result:
# cocoapods
# - Type: git (remotes/origin/master)
# - URL:  https://github.com/CocoaPods/Specs.git
# - Path: /Users/apple/.cocoapods/repos/cocoapods

# trunk
# - Type: CDN
# - URL:  https://cdn.cocoapods.org/
# - Path: /Users/apple/.cocoapods/repos/trunk

# Step 2
pod repo remove cocoapods

# result
# Removing spec repo `cocoapods`

对我有用。

如果有错误:

[!] repo master does not exist

如果您尝试这样做,它将起作用:

pod repo remove cocoapods

别担心,它不会删除您的 pods :)