Cocoapods 使用pod trunk发布程序

来源:互联网 发布:网络翻唱女歌手曼里 编辑:程序博客网 时间:2024/06/07 01:00

1.Cocoapods 使用pod trunk发布程序
2.Framework的CocoaPods制作

1.注册

$ pod trunk register '邮箱' '用户名' --description='电脑描述'

2.查收邮件

如果是QQ邮箱,可能会被放到“垃圾箱”中,并不一定是“收件箱”
点击邮件中的链接:
https://trunk.cocoapods.org/sessions/verify/xxxx

3.接下来查看个人信息

$ pod trunk me

结果信息:

  - Name:     jeikerxiao  - Email:    jeiker@126.com  - Since:    January 11th, 01:43  - Pods:     None  - Sessions:    - January 11th, 01:48 - June 5th, 04:34. IP: xxx.xxx.xxx.xxx Description: Macbook Pro

中间可能遇到这种错误:

NoMethodError - undefined method 'last' for #<Netrc::Entry:0x007fc59c246378>

这时候需要尝试更新gem源或者pod:

$ sudo gem update --system$ sudo gem install cocoapods$ sudo gem install cocospods-trunk

4.创建podspec文件

接下来需要在项目根路径创建一个podspec文件来描述你的项目信息

$ pod spec cretae 文件名

比如

pod spec cretae XXPickerView

就会生成一个XXPickerView.podspec

5.填写podspec内容

Pod::Spec.new do |s|  s.name         = 'XXPickerView'  s.summary      = 'ActionSheet with UIPickerView.'  s.version      = '1.0.0'  s.license      = { :type => 'MIT', :file => 'LICENSE' }  s.authors      = { 'jeikerxiao' => 'jeiker@126.com' }  s.homepage     = 'https://github.com/jeikerxiao/XXPickerView'  s.ios.deployment_target = '7.0'  s.source       = { :git => 'https://github.com/jeikerxiao/XXPickerView.git', :tag => s.version.to_s }  s.requires_arc = true  s.source_files = 'XXPickerView/*.{h,m}'  s.public_header_files = 'XXPickerView/*.{h}'  s.frameworks = 'Foundation', 'CoreFoundation', 'UIKit', 'QuartzCore'end

值得注意的是,现在的podspec必须有tag,所以最好先打个tag,传到github

$ git tag 0.0.1
$ git push --tags

6.检测podspec语法

$ pod spec lint XXPickerView.podspec

7.发布podspec

$ pod trunk push XXPickerView.podspec

8.检测

初始化:

$ pod setup 

更新仓库:

$ pod repo update 

查询上传的版本:

$ pod search XXPickerView

9.仓库更新

如果仓库更新慢,可以考虑更换仓库镜像

$ pod repo remove master$ pod repo add master http://git.oschina.net/akuandev/Specs.git

10.命令

$ pod trunk COMMAND
Usage:    $ pod trunk COMMAND      Interact with the CocoaPods API (e.g. publishing new specs)Commands:    + add-owner      Add an owner to a pod    + delete         Deletes a version of a pod.    + deprecate      Deprecates a pod.    + info           Returns information about a Pod.    + me             Display information about your sessions    + push           Publish a podspec    + register       Manage sessions    + remove-owner   Remove an owner from a podOptions:    --silent         Show nothing    --verbose        Show more debugging information    --no-ansi        Show output without ANSI codes    --help           Show help banner of specified command
0 0