美文网首页iOS进阶指南
CocoaPods使用教程

CocoaPods使用教程

作者: miliPolo | 来源:发表于2016-03-15 23:24 被阅读223次

    1.首先需要安装CocaPods:

    执行下面的命令:

    $ sudo gem install cocoapods

    (由于天朝的长城网,上面的那个命令是无法生效的,你需要执行下面的命令)

    $ sudo gem sources --remove https://rubygems.org/

    //等有反应之后再敲入以下命令

    $ sudo gem sources -a https://ruby.taobao.org/

    下面需要输入你的授权密码,也就是你的登录密码

    然后输入pod setup --verbose 安装需要一段时间,稍等片刻

    2.导入你需要的第三方库,例如Pop(FaceBook出品的动画引擎库,非常好用git地址:https://github.com/facebook/pop)

    首先打开你创建的Project工程,然后进入工程文件夹:

    $ cd~/Path/To/Folder/Code/PopTest

    创建一个Podfile文件:

    $ pod init

    打开Podfile文件进行编辑,这里使用Xcode打开

    $ open -a Xcode Podfile

    文件内容如下:

    # Uncomment this line to define a global platform for your project

    # platform :ios, '8.0'

    # Uncomment this line if you're using Swift

    # use_frameworks!

    target 'PopTest' do

    end

    你需要在target 'PopTest' do

    end 之间添加你需要引用的三方库,例如:

    # Uncomment this line to define a global platform for your project

    # platform :ios, '8.0'

    # Uncomment this line if you're using Swift

    # use_frameworks!

    target 'PopTest' do

    pod 'pop', '~> 1.0'

    end

    保存后,执行:

    $pod install

    另外,如果你使用的swift语言,则需要将下面代码的注释去掉

    # platform :ios, '8.0'

    # use_frameworks!

    相关文章

      网友评论

        本文标题:CocoaPods使用教程

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