美文网首页
iOS 私有库更新

iOS 私有库更新

作者: KingWorld | 来源:发表于2021-04-28 13:16 被阅读0次

    由于本人是使用Sourcetree来使用私有库的,所以底部也会有相对应的命令去更新私有库

    添加完之后要在预编译文件添加头文件

    image.png

    在podspec里面升级版本号

    image.png

    在Podfile.lock里面升级版本号

    image.png

    通过后可以提交代码:

    git add .
    git commit -m "提交代码"
    git push origin master    或者  git push  
    

    如果错误
    这个问题是因为远程库与本地库不一致造成的,那么我们把远程库同步到本地库就可以了。

    git pull --rebase origin master
    

    成功后打tag 必须跟podspec里的一样

    git tag -a '0.2.06' -m "搜索控件UI需求修改"
    git push --tags
    

    成功以后把私有库推到本地

    pod repo push KLSpecs KLCategory.podspec --allow-warnings
    

    如果成功,这时

    open ~/.cocoapods/repos/ 
    

    目录下的 KLSpecs — UIComponent 出现新的版本号。

    完成,可以在项目里更新下来使用了。

    自己需要输入的是
    
    1 git add .
    
    2git commit -m "second"
    
    3git push -u origin master
    
    4git tag 0.1.1
    
    5git push origin 0.1.1
    
    6 apple$ pod repo push LBTestSpec /Users/apple/Desktop/KIT/LXBTestKit/LXBTestKit.podspec --allow-warnings
    
    5、通过后可以提交代码:
    git add .
    git commit -m "提交代码"
    git push origin master    或者  git push  
     
    如果错误
    这个问题是因为远程库与本地库不一致造成的,那么我们把远程库同步到本地库就可以了。 
    git pull --rebase origin master
    
    6、成功后打tag 必须跟podspec里的一样
    git tag -a '0.2.06' -m "搜索控件UI需求修改"
    git push --tags
    7、成功以后把私有库推到本地
    pod repo push KLSpecs UIComponent.podspec --allow-warnings
    如果成功,这时/Users/zhufenghua/.cocoapods/repos/  目录下的 KLSpecs — UIComponent  出现新的版本号。
    
    完成,可以在项目里更新下来使用了。
    
    
    

    在做私有库的时候,执行 push 操作的时候,报如题的错误。

    pod repo push [repo] [podspec]
    

    但是执行pod lib lint的时候,本地验证却是可以通过的。
    然后参考Stack Overflow和google的一些答案,都没能解决。这里就不贴尝试过的别的答案了。
    最终经过反复调试,发现 是自己没有把本地版本、tag版本、远程提交版本同步好。也就是它们之间存在不一致。
    我本地验证可以通过,但是没有通过git add .把发生修改的文件提交到缓冲区,也没有git commit -m "XX"提交到本地仓库。这个时候打的tag,是从本地仓库打的tag。所以就出现了和本地现在的代码不同步。

    所以正确的步骤,是把代码都提交到本地仓库后,再重新打 tag 然后重新push就可以通过了。

    因为之前都是用 source tree。现在直接上手git操作有点不太熟练,导致犯下了低级错误。这个问题确实挺难找的。如果没有意识到是代码不同步的话,很可能会被网上很多答案给带偏了。

    希望我的这种解决能够帮助到有类似问题的人。
    以下是我创建私有库过程中用到的一些命令

    pod命令

    pod spec create XTProtocolManager//生成pod库配置文件
    pod init//生成Podfile
    pod lib lint//验证lib
    pod repo push [repo] [podspec] 
    pod repo push [repo] [podspec]  --verbose --allow-warnings
    

    git命令

    git init//初始化
    git status//查看状态
    git add .//添加文件到缓冲区
    git commit -m "描述"//从缓冲区提交代码到仓库
    git tag -a '0.0.1'  -m '描述'//添加tag
    git tag //查看tag
    git tag -d '0.0.1'//删除tag
    git remote add origin https://github.com/xxx.git//关联本地仓库和远程仓库。
    git push -f origin master//将本地库的代码推到远程库
    git push --tags//将本地创建的tag推到远程库
    git push origin :0.0.1//删除tag
    

    参考:

    podspec specification does not validate 问题解决
    记录一次cocoapod私有库更新
    用Gitblit创建cocoapods远程私有库
    准备提交到cocoapods的遇到的坑
    iOS 私有pod库的发布流程

    相关文章

      网友评论

          本文标题:iOS 私有库更新

          本文链接:https://www.haomeiwen.com/subject/egcvrltx.html