cocoapods系列教程
将自己的库支持CocoaPods
1. 本地新建文件路径,并创建两个文件
-
TestCLD
-->Classes
-->Person.h ,Person.m
2.在 Github
创建自己的项目并获取项目地址URL
3.将本地文件路径变成Git仓库
cd /Users/caolaidong/Desktop/TestCLD
git init
git add .
git commit -m "首次提交"
git push
没有关联远程仓库,无法push
4.将本地仓库和远程仓库地址做关联
git remote add origin https://github.com/LDSmallCat/TestCLD.git
5. 将本地代码推送到远程仓库
git push origin master

6.创建自己项目的描述文件
- 进入项目路径,注意路径在
Classes
文件同级
cd /Users/caolaidong/Desktop/TestCLD
- 创建
.podspec
文件描述自己的项目,文件名一般和项目同名
pod spec create TestCLD
image.png
文件路径结构

7.修改 Podspec文件







8.因为git
版本号tag
还没有标注,此时无法和version
对上.给项目 tag
标记 (和version)
对应
- 查看当前存在的
tag
git tag
- 打标签:
git tag 0.0.1
- 将标签推送到远程:
git push --tags
9.通过Trunk将自己的项目传到Cocoapods
官方地址,供他人使用
- 注册:
pod trunk register 1026190993@qq.com "蛮吉iOS"
您必须单击电子邮件中继中的一个链接,以验证您的中继帐户与当前计算机之间的连接。
image.png
-
pod trunk push TestCLD.podspec
image.png
image.png
- 找不到开源MIT协议文件
license: Unable to find a license file
image.png
image.png
image.png
image.png
image.png
10发布成功.

11.检验自己的项目是否可以被他人正常检索到
将本地索引文件删除,后重新执行pod search
command + shift + L
资源库
command + shift + H
个人中心

常用指令

网友评论