把自己封装的SDK发到 cocoapods上管理

前言:
      这个插件出来很久了,但是一直没用进阶的去使用它,最近要集成ijk(100m)没办法上传到github。那么问题来了,这个代码放哪里呢?为此想到了以下方案:
  1、可以用Git LFS
  2、使用pod去管理,其他组员受影响最低。

话不多说开始思路:

git add .gitignore -f 可吧忽略文件推送到远端

项目放git/自己服务器/打包zip放其他服务器

一、私有pod:创建私有的spec文件仓库

1、首先在github或gitlab上创建一个空项目,这里给个名字是WzlyTIMSpecRepo.

2、终端执行命令:pod repo add  WzlyTIMSpecRepo + git仓库地址

二、创建我们需要pod的项目

1、创建新的文件夹并终端执行命令:pod lib create WzlyTIM  按照提示选完配置

2、在WzlyTIM里面有两个文件夹  Classes(存放源码)、默认会有一个ReplaceMe.m文件(删除)

3、在github或gitlab上创建新的pod项目(项目名WzlyTIM)

4、进入WzlyTIM项目,修改spec文件可直接xcode上修改


把自己封装的SDK发到 cocoapods上管理_第1张图片

5、执行pod lib lint --allow-warnings --verbose 

验证下podspec文的有效性:pod spec lint  WzlyTIM.podspec --verbose

6、如果报错按照报错提示修改对应的错误:多为路径错误

7、成功继续:git remote add origin + 上面项目地址

git add .

git commit -m"init spec"

git push origin master  (覆盖之前提交的文件:git push origin master -f)

8、为仓库打tag(很重要),必须是第8步完成之后,执行这一步,而且这个tag必须和spec文件中的版本一致

git tag 0.1.0

git push --tags

推送到私有仓库

pod repo push WzlyTIMSpecRepo WzlyTIM.podspec --allow-warnings

Validating spec --allow-warnings --verbose

测试:在podfile里

1、source'https://github.com/CocoaPods/Specs.git'

//下面这个地址是管理spec文件的私有库地址,不是pod lib create那个项目的地址source'https://github.com/PPqx/WzlyTIMSpecRepo.git'

2、pod'WzlyTIM',:git=>'https://github.com/PPqx/WzlyTIMSpecRepo.git'

方法二:发布到公共pod上

第8步成功以后:

pod trunk push  WzlyTIM.podspec--allow-warnings

9、执行pod trunk me时的错误

1、[!] Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.

说明你的登录token过期了,需要执行pod trunk register 你的邮箱名,然后去你的邮箱验证一下,就可以了。

你可能感兴趣的:(把自己封装的SDK发到 cocoapods上管理)