美文网首页iOS Developer
Carthage的安装使用

Carthage的安装使用

作者: 张不二01 | 来源:发表于2017-05-18 13:19 被阅读20次

carthage运行脚本中的代码:

/usr/local/bin/carthage copy-frameworks
$(SRCROOT)/Carthage/Build/iOS/你要用的框架名字.framework

安装Carthage

1,打开终端,输入
    $ brew update

    $ brew install carthage
2,测试是否安装成功
    $ carthage version

使用Carthage,安装Alamofire为例

1,进入项目文件夹
cd /Users/mybookios/Desktop/CarthageAlamofireTest
2, 在该文件夹下生成Cartfile文件
    touch Cartfile
3,用Xcode直接打开Cartfile文件或着用命令行如下:
    open -a xcode cartfile
4,在Cartfile写入对应的第三方
    github "Alamofire/Alamofire" ~> 4.4
5,用carthage安装第三方
    carthage update
6,把Carthage->Build->iOS->Alamofire.framework拖拽到项目的Target->General->Linked Frameworks and Librarys中,如下图:
carthage01.png
7,最后在项目的Target->Build Phases->点击加号,创建新的运行脚本,写入对应的地址即可,如下图:
    /usr/local/bin/carthage copy-frameworks
    $(SRCROOT)/Carthage/Build/iOS/Alamofire.framework
carthage02.png

相关文章

网友评论

    本文标题:Carthage的安装使用

    本文链接:https://www.haomeiwen.com/subject/haufattx.html