美文网首页iOS Developer
创建本地cocoapods库

创建本地cocoapods库

作者: Machine_C | 来源:发表于2017-09-14 11:22 被阅读56次

一、创建spec文件

pod lib create [libName]

二、配置spec文件

[s.name](http://s.name)             = 'libName' #名字必须与libname相同
s.version          = '1.0.1' #版本必须为0.0.0格式
s.summary          = 'all gesture view' #关于库的一个简短描述
s.description      = <<-DESC
TODO: 备注文字(较长描述)
                         DESC
#是否支持arc
s.requires_arc = true
#文件主页
s.homepage         = '[https://www.google.com](https://www.google.com)'
#开源协议
s.license          = { :type => 'MIT', :file => 'LICENSE' }
#作者信息
s.author           = { 'kiyo' => '[xxxxxx@qq.com](mailto:xxxxxx@qq.com)' }
#源文件所在网络路径
s.source           = { :git => '[https://github.com/xxxx/libName.git](https://github.com/xxxx/libName.git)', :tag => s.version.to_s }
#自定义framework所在路径
s.vendored_frameworks = 'xxxFrameworks/xxx.framework'
#支持版本
s.ios.deployment_target = '8.0'
#公开头文件名
s.public_header_files = 'Pod/Classes/**/*.h'
#依赖的系统框架
s.frameworks = 'UIKit', 'MapKit'
#依赖的系统静态库
s.libraries = "sqlite3.0"

#依赖的第三方库
s.dependency 'AFNetworking', '~> 2.3'
#Xcode设置
s.pod_target_xcconfig = { "OTHER_LDFLAGS" => "-ObjC -all_load" }

三、本地验证spec文件

// 本地验证
pod lib lint [libName]
// 针对无法正确找到lib.podspec
pod lib lint --source https://github.com/xxxxx/libName.git
// 忽略警告
pod lib lint --allow-warnings

四、提交到远端仓库

// cd到lib目录下
cd [libFolder]
// 由于lib已经在git版本控制下就不需要初始化,直接添加文件提交
git add -A
git commit -s -m "Initial Commit of Library"
// 添加远端仓库
git remote add origin [https://github.com/xxxx/libName.git](https://github.com/xxxx/libName.git)
// 提交到远端仓库
git push orgin master

五、远程验证spec文件

// 远端验证
pod spec lint [libName]

六、打上Tag

git tag -m "first commit" "1.0.1"
git push --tags   

七、注册发布自己的Pods(已注册跳过该步骤)

  • 注册Trunk获取推送资格
// 通过邮箱和用户名注册
pod trunk register [mail] [mailName] --description='xxx'
  • 等到到一份邮件,点击邮件中的链接后验证是否可以查到自己信息
// 验证注册是否成功
pod trunk me

八、发布到cocoapods

// 在工程根目录(包含有.podspec)   
pod trunk push libName.podspec

删除指定pod版本

pod trunk delete PODNAME VERSION

相关文章

  • CocoaPods使用总结

    CocoaPods 公共库的创建CocoaPods 本地私有库的创建(模板创建方式)CocoaPods 本地私有库...

  • Swift 码云创建私有库

    一:创建私有库的索引库先看一张图 二:将创建的索引库添加到本地cocoapods仓库1.cocoapods本地仓库...

  • pod 私有库

    如何创建私有 CocoaPods 仓库 制作 CocoaPods 依赖库 cocoapods本地的类库更新方法 使...

  • 创建私有库

    在GitHub上创建私有库,并使用cocoapods导入使用 1、创建索引库 创建远程索引库 创建本地索引库 1)...

  • cocoapods本地库

    介绍怎么使用cocoapods本地库 1、创建自己的库文件,如 创建TestLibary 在TestLibary中...

  • iOS pod创建本地库

    Xcode pod 本地库 前言 如果没有cocoapods,先安装环境。 创建pod本地库 cd 到项目工程下 ...

  • 创建本地cocoapods库

    一、创建spec文件 二、配置spec文件 三、本地验证spec文件 四、提交到远端仓库 五、远程验证spec文件...

  • iOS组件化-CocoaPods

    组件化练手,首先先使用CocoaPods创建本地私有库和远程私有库。CocoaPods大家都用过,那就废话不多说了...

  • CoCoaPods

    CoCoaPods的原理 创建自己的本地私有库 1.创建本地私有库2.自己的库内容先放到Classes文件夹,再C...

  • CocoaPods本地库上传git仓库和pods官方库

    在上一篇制作 CocoaPods制作本地库中已经完成了本地库的创建。下面接这上传到github 和 Cocoapo...

网友评论

    本文标题:创建本地cocoapods库

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