Cocoapods原理與使用

Cocoapods使用

  • 安裝Cocoapods
  1. 更新自帶Ruby
sudo gem update —system
  1. 更換源
gem sources —add [https://gems.ruby-china.com/](https://gems.ruby-china.com/) —remove [https://rubygems.org/](https://rubygems.org/)
gem sources -l 進行檢查
  1. 安裝Cocoapods
sudo gem install cocoapods 如果出錯執(zhí)行 sudo gem install -n /usr/local/bin cocoapods
pod —version 查看cocoapods 版本號
pod setup 安裝
  • 版本回退
  1. 查找pod安裝路徑并刪除
which pod
sudo rm -rf /usr/local/bin/pod
  1. 查看gems中本地程序包并刪除
gem list
sudo gem uninstall cocoapods -v 1.6.1
sudo gem uninstall cocoapods-core -v 1.6.1
  1. 安裝制定版本的cocoapods
sudo gem install cocoapods -v 1.5.3
  • 制作一個Pod
  1. pod lib create XUAlertView
  2. 寫pod庫內(nèi)容
  3. 編寫podspec、readme.md
  4. 打標簽:
1.本地操作: git tag “0.1.0” (刪除:git tag -d "0.1.0”)
2.遠端操作: git push —tags (git push origin :refs/tags/0.1.0)
  1. pod spec lint xxxxxx.podspec
  2. pod trunk push xxxxxxx.podspec
podspec內(nèi)容
Pod::Spec.new do |s|
    s.name            = 'XUAlertView'
    s.version          = '0.1.0'
    s.summary          = 'XUAlertView'
    s.description      = <<-DESC
    Qingting iOS XUAlertView Framework
    DESC
    s.homepage         = '[https://github.com/xupeng48/xualertview](https://github.com/xupeng48/xualertview)'
    s.license          = { :type => 'MIT', :file => 'LICENSE' }
    s.author           = { 'xupeng' => '[xupeng@qingting.fm](mailto:xupeng@qingting.fm)' }
    s.source           = { :git => '[https://github.com/xupeng48/xualertview.git](https://github.com/xupeng48/xualertview.git)', :tag => s.version.to_s }
    s.ios.deployment_target = '8.0'
    s.requires_arc = true
    s.public_header_files = 'XUAlertView/Classes/**/*.h'
    s.source_files = 'XUAlertView/Classes/**/*'
    s.resource_bundles = {
        'XUAlertView' => ['XUAlertView/Assets/images/*.png’]
    }
end
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容