遇到意外的版本目录类

J. *_*Doe 5 git bitbucket cocoapods

创建私人存储库时出现错误。这是我采取的步骤:

  1. 创建文件夹,运行pod lint创建PrivateRepo并设置值
  2. 在BitBucket中创建私人仓库
  3. 在PrivateRepo文件夹中运行以下命令:

命令:

git add .
git commit -m “Initial Commit"
git remote add origin https://Username@bitbucket.org/Username/privaterepo.git
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
  1. 在我的podspec中更改摘要和主页,并将上面的bitbucket链接设置为源
  2. 运行以下命令:

命令:

git tag 0.1.0
git push origin 0.1.0
Run Code Online (Sandbox Code Playgroud)
  1. 运行pod spec lint --swift-version = 4.1现在可以通过验证
  2. 运行以下命令:

命令:

pod repo add PrivateRepo https://Username@bitbucket.org/Username/privaterepo.git
pod repo push PrivateRepo PrivateRepo.podspec --swift-version=4.1
Run Code Online (Sandbox Code Playgroud)
  1. 到现在为止,还没有发生任何错误。但是,当我想将该Pod安装到另一个项目中时,出现错误消息:

存储库中Classes/Users/Username/.cocoapods/repos/PrivateRepo/PrivateRepoPod 遇到 意外的版本目录PrivateRepo

这是我其他项目中的podfile:

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
Run Code Online (Sandbox Code Playgroud)

这是我的podspec文件:

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
Run Code Online (Sandbox Code Playgroud)

JWh*_*tey 11

看起来您已经快完成了,只是还没有设置您的 podspec 存储库(这是推荐的步骤:https ://guides.cocoapods.org/making/private-cocoapods.html )。

在您的 Podfile 中,尝试将存储库的源 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
Run Code Online (Sandbox Code Playgroud)

我还发现这篇文章有助于设置私人仓库:https : //medium.com/practical-code-labs/how-to-create-private-cocoapods-in-swift-3cc199976a18

编辑

在我们的项目中,我们现在直接将 URL 指向 pod 文件中的 git 源,因为它允许我们快速更改 pod 中的分支,这意味着您可以删除source我上面提到的 2行。无论哪种方式都有效:)。

这是在 pod 文件中直接使用 git 项目的 URL 的示例:

pod ‘PrivatePod’, :git => "git@github.com:Test/privatepod.git"

  • 你好,更改为 `pod 'PrivatePod', :git =&gt; "git@github.com:Test/privatepod.git"` 后,它对我来说工作得很好。 (2认同)