一、本地仓库
1、制作本地仓库
cd到需要制作仓库的文件夹
pod lib create 仓库名字
//例如
pod lib create UtilsLib

创建完成后会自动打开Xcode
替换文件


2、在主项目中pod导入本地仓库,找到刚才制作仓库的路径
pod 'UtilsLib', :path => '../../UtilsLib/UtilsLib'
//
../ 表示返回上层目录
3、执行 pod install
4、打开主项目,导入,编译
二、远程仓库
指定索引仓库
查看当前索引仓库
pod repo
添加索引仓库
pod repo add 仓库名 仓库SSH(HTTPS)地址 来添加一个远程索引仓库
pod repo add ProjectModel https://gitee.com/1234yws/ProjectModel.git
1、将本地仓库上传到自己的私有仓库(网上有很多)我用的是码云
//提交到本地缓存区
git add .
//提交
git commit -m '初始化'
//连接远程库
git remote add origin https://gitee.com/XXX/PrivateProject.git
//强制提交
git push origin master -f
2、校验本地仓库和远程校验
pod lib lint --allow-warnings
pod spec lint --allow-warnings
错误处理
错误@2x.png
解决@2x.png
3、设置.podspec文件

4、打tag标记
git tag 0.1.0
git push --tags
5、将podspec文件提交到远程仓库
pod repo
ProjectModel 私有仓库地址
- Type: git (master)
- URL: https://gitee.com/XXX/ProjectModel.git
- Path: /Users/XXX/.cocoapods/repos/ProjectModel
master
- Type: git (master) cocoapods公有仓库地址
- URL: https://github.com/CocoaPods/Specs.git
- Path: /Users/XXX/.cocoapods/repos/master
6、上传至远程私有库
cd本地库文件路径,提交.podspec
pod repo push ProjectModel PrivateProject.podspec
三、远程库版本更新
1、本地库修改,然后提交到远程库
//提交到本地缓存区
git add .
//提交
git commit -m '初始化'
//连接远程库 git remote add origin 远程仓库地址
git remote add origin https://gitee.com/1234yws/PrivateProject.git
//强制提交
git push origin master -f
2、校验本地仓库和远程校验
pod lib lint --allow-warnings
pod spec lint --allow-warnings
4、打tag标记
git tag 0.1.1
git push --tags
5、上传至远程私有库
cd本地库文件路径,提交.podspec
pod repo push ProjectModel PrivateProject.podspec
6、去工程中执行pod install
附录
podfile文件内容
#远程私有库
source 'https://gitee.com/1234yws/ProjectModel.git'
#Cocoapod远程公有库
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target'textGit'do
pod 'AFNetworking'
pod 'PrivateProject','~>0.1.2'
end
网友评论