Carthage的安装/使用

一. 安装

1.打开终端

2. 安装Homebrew:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3. 获取最新版本: brew update

4. brew安装完成,安装carthage:brew install carthage

5. 如果你之前安装过carthage,需要更新carthage的话,先卸载carthage: brew uninstall carthage

6. brew install/uninstall(这个过程很快)```

![brew install/uninstall](http://upload-images.jianshu.io/upload_images/1706253-4a20c501a15e4a04.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

二. 使用

  1. 打开项目路径:

  2. 创建并且编辑Cartfile文件: vim Cartfile, "i"切换到编辑模式,
    输入你需要到的框架,例如:“github "SnapKit/SnapKit" ~> 3.0.2”
    然后"esc"退出编辑模式,“shift”+“:”,最后输入“wq”,保存并推出编辑模式。

  3. 更新安装:“carthage update --platform ios” ```

carthage update --platform ios

三.项目配置

1. 导入框架:

选择“Targets”->“General”->“Linked Frameworks and Libraries”,
点击“+”号,选择“Add Other...”

在“[项目路径]/Carthage/Build/iOS”找到对应的“xxx.framework”,
单击,选择“open”,就加入完成。

2. 配置“Run Script”,方法如下

选择“Targets”->“Build Phases”,点击“+”号,选择“New Run Script Phase”

展开“Run Script”,将“Shell”下方区域修改成“/usr/local/bin/carthage copy-frameworks”

在“Input Files”加入你所有的框架,
格式如下“$(SRCROOT)/Carthage/Build/iOS/[你的框架名称]”

Linked Frameworks and Libraries
Run Script
Input Files
import
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • carthage运行脚本中的代码: 安装Carthage 1,打开终端,输入 2,测试是否安装成功 使用Carth...
    张不二01阅读 284评论 3 0
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,080评论 19 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,885评论 25 709
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,985评论 6 342
  • 霏霏雨斜湿窗柩 抬看焦阳退半边 白云化雨犹不定 先派小珠作前探
    江小昨阅读 297评论 6 8