git - An unexpected version directory Classes was encountered
问题描述
I get an error while create a private repo. This are the steps I take:
- Create folder, run pod lint create
PrivateRepo
and set the values - Create private repo in BitBucket
- Run this command in the PrivateRepo folder:
commands:
git add .
git commit -m “Initial Commit"
git remote add origin https://Username@bitbucket.org/Username/privaterepo.git
git push -u origin master
- Change the summary and homepage in my podspec, and set the bitbucket link above as source
- Run this commands:
commands:
git tag 0.1.0
git push origin 0.1.0
- Running pod spec lint --swift-version=4.1 now passes validation
- Run this commands:
commands:
pod repo add PrivateRepo https://Username@bitbucket.org/Username/privaterepo.git
pod repo push PrivateRepo PrivateRepo.podspec --swift-version=4.1
- Till now, no error has ocurred. However when I want to pod install that pod into my other project, I get an error:
An unexpected version directory
Classes
was encountered for the/Users/Username/.cocoapods/repos/PrivateRepo/PrivateRepo
Pod in thePrivateRepo
repository.
This is my podfile in my other project:
source 'https://Username@bitbucket.org/Username/privaterepo.git'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ’10.3’
target 'OtherProject' do
use_frameworks!
pod 'PrivateRepo'
end
This is my podspec file:
Pod::Spec.new do |s|
s.name = 'PrivateRepo'
s.version = '0.1.0'
s.summary = 'test'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://google.com'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Username' => 'Username@hotmail.com' }
s.source = { :git => 'https://Username@bitbucket.org/Username/privaterepo.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.source_files = 'PrivateRepo/Classes/**/*'
end
解决方案
看起来您快到了,但还没有设置您的 podspec 存储库(这是推荐的步骤:https ://guides.cocoapods.org/making/private-cocoapods.html )。
在您的 Podfile 中,尝试将您的 repo 的源 URL 替换为您的规范的源 URL。例如:
source 'https://username@bitbucket.org/username/private-repo-specs.git'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ’10.3’
target 'OtherProject' do
use_frameworks!
pod 'PrivateRepo'
end
我还发现这篇文章有助于建立一个私人仓库: https ://medium.com/practical-code-labs/how-to-create-private-cocoapods-in-swift-3cc199976a18
编辑
在我们的项目中,我们现在直接 URL 到 pod 文件中的 git 源,因为它允许我们快速更改 pod 中的分支,并且意味着您可以删除source
我上面提到的 2 行。无论哪种方式都有效:)。
下面是一个使用 URL 直接指向 pod 文件中的 git 项目的示例:
pod ‘PrivatePod’, :git => "git@github.com:Test/privatepod.git"
推荐阅读
- java - Karaf 中 PersistenceProviderImpl 的 ClassCastException
- c# - 尝试删除 Azure blob - 获取 blob 不存在异常
- node.js - 在 Mac OS 中启动终端时,我突然收到一条 nvm 安装错误消息
- express - IONIC 4 登录得到响应,但无法读取自定义错误消息
- c# - 如何在不下载 Azure Blob 存储的情况下返回图像
- python - Matplotlib 显示错误的 y 轴值
- php - 使用 PHP 和 SQL 删除表条目
- python - 从夹具返回结构化数据的正确方法是什么?
- powershell - 将更改的 CSV 数据复制到新的 CSV
- sql - SQL 视图错误 - 消息 207,级别 16,状态 1,过程 OrderItems_vw,第 16 行 [批处理开始行 0] 无效的列名“品牌”