Cocoapods官网:https://guides.cocoapods.org/making/private-cocoapods.html
查看已发布的Pod:https://trunk.cocoapods.org/claims/new
一,提交到私有索引库
1,把framework推送到git或私有仓库,打上tag
git tag 1.0 && git push origin --tags
2,创建MyFramework.podspec索引文件
pod spec create MyFramework
Pod::Spec.new do |s|
s.name = "MyFramework"
s.version = "1.0"
s.summary = "My first framework"
s.description = <<-DESC
It's my first framework.
DESC
s.ios.deployment_target = "9.0"
s.source = { :git => "https://github.com/xxxx/myframework.git",
:tag => s.version }
s.public_header_files = ["MyFramework/MyFramework.h"]
spec.dependency 'AFNetworking'
end
3,创建私有spec仓库如:
https://github.com/xxxx/mySpec.git
4,将仓库添加到CocoaPods安装中
添加仓库
pod repo add my-specs https://github.com/xxxx/mySpec.git
检查安装是否成功并准备就绪:
cd ~/.cocoapods/repos/mySpec
pod repo lint.
5,提交MyFramework.podspec到私有索引库
验证podspec
pod spec lint MyFramework.podspec
注意:podspec中,如果spec.dependency 依赖私有索引库,验证需要添加私有索引库源
pod spec lint xxxxx.podspec --sources='https://github.com/xxxx/xxxSpec.git,https://cdn.cocoapods.org' --allow-warnings
推送podspec私有索引库
pod repo push mySpec MyFramework.podspec
二,Podfile指定索引库
1,
source 'https://github.com/xxxx/mySpec.git'
platform :ios, ‘9.0’
target ‘test’ do
pod MyFramework'
end
2,或
platform :ios, ‘9.0’
target ‘test’ do
pod MyFramework',:source=> 'https://github.com/xxxx/mySpec.git'
end