安裝和使用Carthage

來源:互聯網
上載者:User

標籤:

0x01、首先安裝OSX套件管理器Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

 

0x02、使用 Homebrew 進行安裝Carthage 安裝之前先對Homebrew進行更新一下 不然可能會安裝到比較老版本的Carthage

brew update

 

0x03、Homebrew 安裝Carthage

brew install carthage

 

 到這裡已經把Carthage工具安裝完畢 

 下面是開始使用Carthage工具管理組件(Carthage 是由 Swift 語言寫的,只支援動態架構,只支援 iOS8+。 目前只支援github 或者git 相關管理源的庫)

0x04、添加 Cartfile 檔案 寫法可參數官方例子 (https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md)

        如:github "ReactiveCocoa/ReactiveCocoa" >= 2.3.1

0x05、再執行 carthage update ;在執行 carthage update 命令後會在根目錄建立一個 Cartfile.resolved 檔案,這個檔案是產生後的依賴關係,不能修改,同時還會產生一個Carthage 檔案夾 裡面放的是編譯好的.framework檔案

 

  • Cartfile 檔案用來標註你需要哪些依賴庫,對應版本或者 Git 分支 (需要提交到 Git)
  • Cartfile.resolved 檔案用來跟蹤項目當前所用的依賴版本號碼,為了保持多端開發一致 (需要提交到 Git)
  • Carthage 檔案夾用來存放依賴庫的源檔案和編譯後的檔案 (不需要提交到 Git)

0x06、把編譯好的.framework 檔案同時放到Bild Phases 下面的Link Binary With Libraries裡和General 裡的Embedded Binaries裡

0x07、添加修改.gitignore檔案  添加 Carthage作為忽然檔案夾 

 

例子:https://github.com/yanyan1119/TestCarthage

 

安裝和使用Carthage

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.