此文章默认您已安装cocoapods
1、先去github创建一个项目,格式如下

2、git clone https://github.com/caoyunxiao/YXProgressHUDView
“https://github.com/caoyunxiao/YXProgressHUDView”换成自己的项目地址
3、把需要上传的框架加入工程,并push到github,并为此次提交打上tag,此tag和下文中podspec文件里source tag 必须一样
git tag '1.0.0'
git push --tags
4、创建podspec文件
pod spec create YXProgressHUDView
5、修改podspec文件
Pod::Spec.new do |s|
s.name = "YXProgressHUDView"
s.version = "1.0.0"
s.summary = "An iOS activity indicator view."
s.description = <<-DESC
YXProgressHUDView 基于MBProgressHUD的在封装,只为使用更简单
DESC
s.homepage = "https://github.com/caoyunxiao/YXProgressHUDView"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Matej caoyunxiao' => 'chinacgcgcg@163.com' }
s.source = { :git => "https://github.com/caoyunxiao/YXProgressHUDView.git", :tag => "1.0.0" }
s.ios.deployment_target = '8.0'
s.tvos.deployment_target = '9.0'
s.source_files = "YXProgressHUDView/*.{h,m}"
s.requires_arc = true
s.dependency "MBProgressHUD", "~> 1.0.0"
s.resources = "YXProgressHUDView/Resources/*.png"
end
6、注册cocoapods账号
pod trunk register 邮箱地址 '用户名' --description='描述信息'
输入如下命令可查看个人cocoapods账号信息,检查是否注册成功
pod trunk me
7、pod spec lint(检查podspec文件格式是否正确)后面加--verbose可打印详细信息
出现下图时才表示正确无误

8、上传到Cocoapods服务器
pod trunk push YXProgressHUDView.podspec
出现下图就表示上传成功

9、更新本地pod依赖库
pod setup
10、使用
pod search YXProgressHUDView,如果搜索不到没关系
直接在podfile文件里使用,如果能成功使用说明没问题。
pod search 解决办法
pod setup成功后会生成~/Library/Caches/CocoaPods/search_index.json文件。
终端输入rm ~/Library/Caches/CocoaPods/search_index.json
删除成功后再执行pod search






网友评论