ios - 尝试访问私有依赖项时,开发中的私有 cocoapod 无法 lint
问题描述
作为快速介绍,所有涉及的 cocoapods 都保存在私有存储库中。
一些一般信息:
- Cocoapods 版本 1.9.1(截至今天最新)
- Xcode 11.3.1
- 命令行工具 Xcode 11.3.1 (11C504)
- 斯威夫特 5.0
- macOS 10.15.3
我已经成功配置了两个 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.
正如刚才提到的:
- 我确实更新了我的回购并确认了预期的文件
- 验证所有版本数据。这包括将文本直接从
Podfile
有效的复制到Podspec
无效的 Podfile
通过将 pod 成功安装到示例目标中来确认repo 存在于& 中
我也采取了一些额外的步骤。
- 已删除派生数据
pod deintegrate
并重新安装- 重新启动 Xcode
- 往电脑上扔东西
解决方案
我将我的lint
命令修改为以下内容,现在它可以工作了:
pod lib lint --sources=my_repo,trunk
显然,您必须为带有标志的lint
命令提供私有存储库。--sources
就我而言,my_repo
需要包含我的私人仓库,而trunk
需要包含公共 pod。将两者结合起来使可可足类动物感到高兴。
推荐阅读
- javascript - 为什么删除对javascript中的数组不起作用?
- javascript - 将 React 导出到 word - 放置在同一个文档中的超链接
- javascript - 尝试使用 PUT 路由更新字幕 (node.js/express)
- amazon-web-services - Aws amplify signIn 方法在 federatedSignIn(托管 UI)工作时返回不正确的用户名和密码
- html - VScode - 用值替换捕获的组
- provider - @metamask/detect-provider:无法检测到 window.ethereum
- php - 在 laravel 中使用原始查询从 sql 数据库中获取特定列
- javascript - 如何访问外部 javascript 文件中的数组中的数据以在使用 chart.js 的图表中使用?
- javascript - 不使用单个文件组件时强制重新生成 vue 3 中的代码
- javascript - 如何从商店内部访问操作或进行调度