代码之家  ›  专栏  ›  技术社区  ›  J. Doe

遇到意外的版本目录类

  •  14
  • J. Doe  · 技术社区  · 7 年前

    我在创建私人回购时出错。以下是我采取的步骤:

    1. 创建文件夹,运行pod lint Create 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
    
    1. 更改我的podspec中的摘要和主页,并将上面的bitbucket链接设置为源
    2. 运行以下命令:

    命令:

    git tag 0.1.0
    git push origin 0.1.0
    
    1. 运行pod spec lint--swift版本=4.1现在通过验证
    2. 运行以下命令:

    命令:

    pod repo add PrivateRepo https://Username@bitbucket.org/Username/privaterepo.git
    pod repo push PrivateRepo PrivateRepo.podspec --swift-version=4.1
    
    1. 到目前为止,没有发生任何错误。但是,当我想将该pod安装到我的其他项目中时,我会遇到一个错误:

    意外的版本目录 Classes 遇到的 /Users/Username/.cocoapods/repos/PrivateRepo/PrivateRepo Pod输入 这个 PrivateRepo公司 存储库。

    这是我在其他项目中的播客文件:

    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
    

    这是我的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
    
    2 回复  |  直到 7 年前
        1
  •  13
  •   JWhitey    6 年前

    看起来你就快到了,只是还没有设置你的podspec回购(这是一个推荐的步骤: https://guides.cocoapods.org/making/private-cocoapods.html )。

    在Podfile中,尝试将repo的源URL替换为spec的源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中的分支,并且意味着您可以删除2 source 我上面提到的几行。但无论哪种方式都可以:)。

    以下是在pod文件中直接使用指向git项目的URL的示例:

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

        2
  •  0
  •   mfaani    3 年前

    遇到此问题是因为:

    An unexpected version directory `1.0.1_customBuild_90` was encountered for the `/Users/mfaani/.cocoapods/repos/Product-specs/MyPod` Pod in the `MyPod` repository.`
    

    基本上 1.0.1_customBuild_90 不符合标准。