一、Carthage項目管理工具使用?
Step 1:安裝/更新Homebrew工具
1、
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2、
brew install carthage
3、
brew link carthage
4、
brew install carthage
5、
brew reinstall carthage
成功!
Step 2:源碼方式->項目安裝carthage
1、在項目根目錄建立carthage檔案
指令:
touch Cartfile
2、打開Cartfile檔案添加第三方庫
例如:
github "rs/SDWebImage"
3、安裝
carthage update
解決方案:Carthage是先将第三方架構編譯成動态庫(.framework的二進制檔案),是以需要先指定一個編譯工具。在Xcode>Preferences > Locations中的下拉菜單裡選擇指令行工具。
4、繼續安裝
carthage update
,下載下傳成功。
5、去掉不需要的版本及平台,僅保留我們需要的
SDWebImage iOS
,先删除Build檔案中所有的版本
終端執行:
carthage help update
根據
help
,可以發現使用
carthage update --platform iOS
指令,可以指定你需要的平台
6、手動添加至項目中,然後删除不需要的檔案
删除
Build
檔案
删除除
WebImage
,
Vendors
,
SDWebImage
以為的其他檔案
最終項目的目錄結構:
方式二:靜态庫引入方式
直接運作報錯
配置
運作