一.先上传项目到 github
1.登陆github
2.创建仓库
3.下载仓库到本地 (我一般都xcode的下载)
4 将打包好的 framework放到项目下
5.终端提交项目到 github上
cd 文件路径
git add -A
git commit -m ""
git push origin
6.为项目标记tag 再次提交
git tag 1.0.0 添加tag
git push origin --tags 提交tag
二. 上传cocoa pods
1.在工程根目录初始化一个Podspec文件 最好与你项目同名
pod spec create YYBaseLib
2.配置文件
spect文件标准格式 tag 一定写对和github tag要一致
参考官方文件 https://guides.cocoapods.org/syntax/podspec.html
上传需要打包的整个工程 的配置文件
Pod::Spec.new do |spec|
spec.name = 'YYBaseLib'
spec.version = '1.0.15'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/chuanxiaoshi/YYBaseLib'
spec.authors = { '' => '@163.com' }
spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
spec.source = { :git => 'https://github.com/chuanxiaoshi/YYBaseLib.git', :tag =>'1.0.15' }
spec.platform = :ios, '8.0'
spec.source_files = 'YYBaseLib/**/*.{h,m}'
spec.frameworks = 'UIKit','AVFoundation','Foundation'
spec.dependency 'AFNetworking', '~> 2.0'
spec.dependency 'Masonry'
spec.dependency 'YYModel'
spec.dependency 'MJRefresh'
spec.dependency 'SDWebImage'
end
只上传framework的配置文件
Pod::Spec.new do |spec|
spec.name = 'YYBaseLib'
spec.version = '1.1.0'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/chuanxiaoshi/YYBaseLib'
spec.authors = { ''zhanghao" => 'youxiang@163.com' }
spec.summary = 'jianjie.'
spec.source = { :git => 'https://github.com/chuanxiaoshi/YYBaseLib.git', :tag =>'1.1.0' }
spec.platform = :ios, '8.0'
spec.vendored_frameworks = 'YYBaseLib.framework'
spec.frameworks = 'UIKit','AVFoundation','Foundation'
end
3.创建账号
pod trunk register 邮箱 联系人 --description="描述" --verbose
创建成功会收到邮件,进邮箱验证
pod trunk me 可查看trunk信息
4.trunk push之前要先验证
pod spec lint YYBaseLib.podspec
出现 YYBaseLib.podspec passed validation表示通过了
如果只是waring通过 pod lib lint --allow-warnings强制忽略
如何 想看错误详情 pod spec lint YYBaseLib.podspec --verbose
如果有错, 看下配置文件哪里错了,
5.pod trunk push 这个有点耐心, 需要会时间
6.成功后pod search YYBaseLib
7.如果搜索不出来 更新下cocoapods
pod setup
参考链接
http://www.cocoachina.com/ios/20160301/15459.html
http://blog.csdn.net/michaelkiven/article/details/49658277
http://www.jianshu.com/p/001f5cf05b6d