iOS pod私有库创建和升级

穿精又带淫゛_ 提交于 2019-11-28 00:52:08

今天尝试了一下封装pod私有库,步骤其实蛮简单

创建私有库

1. 先在github上创建一个自己的公开的仓库(记得添加MIT LICENSE)

2. 克隆仓库到本地

3. 创建.podspec文件

pod spec create +名称(和仓库名称一致)

pod spec create YFToolKit

4. 配置.podspec

s.name          = "YFToolKit"
s.version       = "0.0.1"
s.summary       = "我的自定义库 YFToolKit."
s.description   = <<-DESC
                    我的自定义库,目前是测试版,里面啥都没有!
                DESC
s.homepage      = "https://github.com/TsingYii/YFToolKit"
s.license       = "MIT"
s.author        = { "yufang" => "yufang93@qq.com" }
s.platform      = :ios, "8.0"
s.source        = { :git => "https://github.com/TsingYii/YFToolKit.git", :tag => "#{s.version}" }
s.source_files  = "Classes", "Classes/**/*.{h,m}"
s.framework     = "UIKit", "Foundation"
//私有库依赖的第三方
//s.dependency    'AFNetworking', '~> 3.1.0' 
//s.dependency    'Masonry', '~> 1.0.2'

5.验证pod是否通过

pod lib lint

6.提交代码到git(add commit push)

7.设置tag

git tag 0.0.1
git push --tags

8.使用Trunk发布pod

8.1 注册trunk

pod trunk register 邮箱 '用户名' --description='描述'  

然后去邮箱验证

8.2验证是否注册成功

pod trunk me

8.3发布

pod trunk push [NAME.podspec](也可省略提交对象)

然后就可以pod search 搜索自己的库了

 升级

1.修改代码

2.提交到git

3.修改spec.version中的版本号

4. 发布

pod cache clean --all // 清除pod缓存
pod lib lint   //校验
pod trunk push xxxx.podspec --allow-warnings//发布

删除pod

pod trunk delete YFToolKit 0.0.1  //删除
pod trunk deprecate YFToolKit     //废弃
pod setup

疑问

更新的时候,不需要再打tag吗?

参考资料

https://blog.csdn.net/yaoliangjun306/article/details/73550902 (iOS更新CocoaPods公有库的版本)

https://www.jianshu.com/p/f61977e58eca(制作自己的CocoaPods封装)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!