1、新建仓库:
登录github,新建一个仓库(Repository):


2、clone仓库到本地:
1、 copy仓库URL,具体可见上图中的URL
2、 克隆(clone)仓库到本地:
git clone https://github.com/Dongxk/AI_Face.git


3、添加podspec描述文件:
步骤:
cd 到项目下 -> 创建spec文件
pod spec create AI_Face


4、编辑podspec文件:
1、配置文件:

s.name : 项目名
s.version : 版本号(需跟后面打 Tag 的值相等)
s.homepage : 项目主页
s.license : 开源协议(这里我们选择 MIT )
~建议格式
s.license= { :type => "MIT", :file => "LICENSE" }
s.source : Git 仓库地址
s.ios.deployment_target : 项目最低支持版本
s.source_files : 具体去那个目录下下载特定共享代码
~建议格式
source_files:写法及含义建议大家写第一种或者第二种
“AI_Face/*”
“AI_Face/Classes/*.{h,m}”
“AI_Face/**/*.h”
“*” 表示匹配所有文件
“*.{h,m}” 表示匹配所有以.h和.m结尾的文件
“**” 表示匹配所有子目录
s.frameworks : 项目所依赖的系统库
s.dependency : 项目所依赖的第三方库 示例:s.dependency 'AFNetworking'
2、 验证配置:
出现 passed validation. 即验证成功!
pod lib lint

可以看出第一次没有验证通过,提示有一个警告,可用如下语句忽略警告:
pod lib lint --allow-warnings
有时候也会报错,一般都会提示具体报错的地方,大部分错误原因都是格式书写错误。
5、上传项目到GitHub仓库(包括打tag):
git init
git add .
git remote add origin 仓库地址
git commit -m “描述”
git tag -a 1.0.0 -m ”描述” //这里的版本号一定要和podspec配置文件中的一致
git push origin –tags
git push


5、发布podspec到Cocoapod上:
1、测试一下自己有没有注册trunk成功:
pod trunk me

2、 注册:
pod trunk register 邮箱 [用户名]

3、 注册成功:
需要到邮箱中验证激活!

4、 push podspec
pod trunk push AI_Face.podspec

6、验证:
pod 搜索刚上传成功的AI_Face

网友评论
- ERROR | [iOS] file patterns: The `source_files` pattern did not match any file.
https://github.com/shang1219178163/EveryThing
├── BN_Category
│ ├── BN_Category.h
│ ├── NSObject+CashProtector.h
│ ├── NSObject+CashProtector.m
│ ├── NSObject+swizzling.h
│ ├── NSObject+swizzling.m
├── BN_Category.podspec
├── LICENSE
└── README.md
BN_Category.h:14:9: fatal error: 'NSObject+CashProtector.h' file not found
#import "NSObject+CashProtector.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.