zoukankan      html  css  js  c++  java
  • cocoaPod 安装

     可参考高德指南  http://lbs.amap.com/api/ios-location-sdk/guide/create-project/cocoapods

    参考: http://blog.devtang.com/2014/05/25/use-cocoapod-to-manage-ios-lib-dependency/

    更新Cocoapods: http://www.tuicool.com/articles/URjqQvb

    <1.首先>安装ruby环境:http://www.cnblogs.com/daguo/p/4097263.html 

     更新ruby的版本:  http://blog.csdn.net/fairytale_1/article/details/51850734

    查看ruby的版本

    ruby -v 

     

    查看目前的所有ruby版本:

    rvm list known

    如果提示command not found 请先安装rvm

    $curl -L get.rvm.io | bash -s stable  

    这里我们安装2.2.2:

     

    $rvm install 2.2.2

    终端运行结果:(如果直接成功请绕过homebrew的卸载安装)

     

    Searching for binary rubies, this might take some time.

    Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.11/x86_64/ruby-2.2.2.tar.bz2

    Checking requirements for osx.

    About to install Homebrew, press `Enter` for default installation in `/usr/local`,

    type new path if you wish custom Homebrew installation (the path needs to be writable for user)

     

    回车:

     

    It appears Homebrew is already installed. If your intent is to reinstall you

    should do the following before running this installer again:

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

    The current contents of /usr/local are .git

    Requirements installation failed with status: 1.

     

    这里执行:

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

    卸载home-brew

     

    Warning: This script will remove:

    /Library/Caches/Homebrew/

    /usr/local/.git/

    Are you sure you want to uninstall Homebrew? [y/N] y

    ==> Removing Homebrew installation...

    ==> Removing empty directories...

    ==> Homebrew uninstalled!

    You may want to restore /usr/local's original permissions

      sudo chmod 0755 /usr/local

      sudo chgrp wheel /usr/local

     

    再执行:

     $ rvm install 2.2.2

     

     

     

     

    安装CocoaPods

    $ sudo gem install CocoaPods

     

    如安装失败,则继续

    <2.然后>安装cocoaPods(如果已经安装,直接第三步)

    1.改变镜像指向

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

    $ gem sources -remove https://ruby.taobao.org/

     

    完成后,我们使用如下命令查看Ruby镜像是否已经指向了淘宝

    $ gem sources -l

    如下表示成功

     

     

     

    然后重新执行安装命令等待结束就可以了

    $ sudo gem install CocoaPods

    //如果没有权限, 则使用:

    sudo gem install cocoapods -n /usr/local/bin

     

    执行完毕会看到如下信息:

     

    此时,CocoaPods已经安装完毕

     

     

    <3.使用>CocoaPods集成第三放库

    例:

    首先使用如下命令,查看CocoaPods是否支持SDWebImage类库

    搜索库名

    $ pod search SDWebImage 

    搜出来之后,退出:

    q

    回车:

    cd 工程的路径

    初始化一个pod:

    pod init

    打开工程中的Podfile文件:

    open -a Xcode Podfile

    Podfile中写入需要安装的第三方库 以及版本

    (target “文件名” do

    //其他的可以全部删掉

    //在这里写 

    platform :ios, '7.0'

    pod ‘AFNetworking’ ‘~>2.5.3’

    pod 'SDWebImage', '~> 3.7.2'  

    end)

    关闭文件后,在终端安装:

    pod install

    升级 (推荐用update,其中update就包含了install)

    $ pod update

    如果update 或 install 卡住了,可以用下面两个命令替代(前提是你已经把第三方库下载下来了)

    原因在于当执行以上两个命令的时候会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下:

    $ pod install --verbose --no-repo-update
    $ pod update --verbose --no-repo-update



    错误提示:

    1.提示Unable to find a specification for `xxxxx`的问题,在这里找到了解决方法:

    只需要把当前Pod的目录清理一下就行了。在终端执行以下命令:

    pod repo remove master  
    pod setup

    最后当然还是要用pod install --verbose --no-repo-update才行,用pod install会出现一直Analyzing dependencies

     

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    错误信息

    安装cocoaPods 过程中可能遇到的问题

    http://www.cnblogs.com/yan520/p/5583362.html

    错误:权限,试试下面的命令

    ERROR:  While executing gem ... (Gem::FilePermissionError)

        You don't have write permissions for the /usr/bin directory.

     sudo gem install -n /usr/local/bin cocoapods

    http://www.jianshu.com/p/6e5c0f78200a

     

     

  • 相关阅读:
    fork()
    定时器
    epoll函数
    select函数
    高性能服务器程序框架
    socker地址API
    点击选中/取消选中flag
    html5的视频和音频
    html5
    JavaScript的string方法(demo)
  • 原文地址:https://www.cnblogs.com/daxueshan/p/5814874.html
Copyright © 2011-2022 走看看