首页 > 解决方案 > 尝试访问私有依赖项时,开发中的私有 cocoapod 无法 lint

问题描述

作为快速介绍,所有涉及的 cocoapods 都保存在私有存储库中。

一些一般信息:

我已经成功配置了两个 Cocoapod 已发布到的私有规范存储库。我的本地存储库已使用 Cocoapod 发布的步骤进行了更新,并且我验证了预期的podspec文件是否存在。

pod repo add my_repo https://gitsite.com/my-spec-repo.git

然后在我的机器上验证:

cd ~/.cocoapods/repos/my_repo
pod repo lint .

我还直观地验证了正确的文件和版本是否存在。

然后我将源添加到消费应用程序中Podfile,如下所示:

source 'https://gitsite.com/my-spec-repo/'
source 'https://cdn.cocoapods.org/'

完成所有这些步骤后,一切正常,我可以安装和使用 pod。因此,到目前为止一切都很好。

我现在正在构建一个新的私有 Cocoapod,它必须消耗我的一个私有 pod。

在我的podspec文件中,我标记了依赖项:

s.dependency 'my_private_pod', '~> 1.2.3'

我还在我Podfile的示例应用程序中包含了一个条目。

pod 'my_private_pod', '~> 1.2.3'

当我在我的新私有 pod 上更新 repo 时pod repo update,一切正常,我看到 pod 成功安装并且可以查看我项目中的文件。

然而,问题在于试图以发布它的最终目标对新 pod 进行 lint。

 -> my_new_private_pod (0.0.1)
    - ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for `my_private_pod (~> 1.2.3)` depended upon by `my_new_private_pod`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.
) during validation.

[!] my_new_private_pod did not pass validation, due to 1 error.

正如刚才提到的:

  1. 我确实更新了我的回购并确认了预期的文件
  2. 验证所有版本数据。这包括将文本直接从Podfile有效的复制到Podspec无效的
  3. Podfile通过将 pod 成功安装到示例目标中来确认repo 存在于& 中

我也采取了一些额外的步骤。

标签: iosxcodecocoapods

解决方案


我将我的lint命令修改为以下内容,现在它可以工作了:

pod lib lint --sources=my_repo,trunk

显然,您必须为带有标志的lint命令提供私有存储库。--sources

就我而言,my_repo需要包含我的私人仓库,而trunk需要包含公共 pod。将两者结合起来使可可足类动物感到高兴。


推荐阅读