利用pod trunk發(fā)布程序
注冊
- pod trunk register 郵箱 "用戶名" --description="電腦描述"
查收郵件
- 如果是QQ郵箱,可能會(huì)被放到“垃圾箱”中,并不一定是“收件箱”
- 點(diǎn)擊郵件中的鏈接:
https://trunk.cocoapods.org/sessions/verify/xxxx
接下來查看個(gè)人信息
pod trunk me
- Name: yuehuig
- Email: 475993847@qq.com
- Since: April 20th, 01:21
- Pods:
- YHCategory
- Sessions:
- April 20th, 01:21 - October 7th, 20:29. IP: 1.202.151.202
- 中間可能遇到這種錯(cuò)誤
NoMethodError - undefined method 'last' for #<Netrc::Entry:0x007fc59c246378>
- 這時(shí)候需要嘗試更新gem源或者pod
sudo gem update --system
sudo gem install cocoapods
sudo gem install cocospods-trunk
準(zhǔn)備項(xiàng)目名稱
- 先查看下名稱是否存在
pod search YHCategory
若不存在會(huì)顯示
[!] Unable to find a pod with name, author, summary, or description matching `YHCategory`
不存在我們就可以使用了。
創(chuàng)建podspec文件
- 接下來需要在項(xiàng)目根路徑創(chuàng)建一個(gè)podspec文件來描述你的項(xiàng)目信息
pod spec create 文件名
- 比如pod spec create YHCategory就會(huì)生成一個(gè)YHCategory.podspec
填寫podspec內(nèi)容
Pod::Spec.new do |s|
s.name = "YHCategory"
s.version = "0.0.1"
s.summary = "The fastest and most convenient conversion between JSON and model"
s.homepage = "https://github.com/Theshy/YHCategory"
s.license = "MIT"
s.author = { "Theshy" => "xxxxx@qq.com" }
s.social_media_url = "http://weibo.com/exceptions"
s.source = { :git => "https://github.com/Theshy/YHCategory", :tag => s.version }
s.source_files = "YHCategory/YHCategory/YHCategory"
s.requires_arc = true
end
- 值得注意的是,現(xiàn)在的podspec必須有tag系羞,所以最好先打個(gè)tag柑肴,傳到github
git tag 0.0.1
git push --tags
檢測podspec語法
pod spec lint YHCategory.podspec
發(fā)布podspec
pod trunk push YHCategory.podspec
- 如果是第一次發(fā)布pod灼芭,需要去https://trunk.cocoapods.org/claims/new認(rèn)領(lǐng)pod
檢測
-
pod setup
: 初始化 -
pod repo update
: 更新倉庫 pod search YHCategory
倉庫更新
- 如果倉庫更新慢废膘,可以考慮更換倉庫鏡像
pod repo remove master
pod repo add master http://git.oschina.net/akuandev/Specs.git