zoukankan      html  css  js  c++  java
  • CocoaPods

    1.安装

     

    1. $ sudo gem install cocoapods  

     

    1. $ pod setup  

     

    //出现问题 install 没反应

    1. $ gem sources --remove https://rubygems.org/  
    2. //等有反应之后再敲入以下命令  
    3. $ gem sources -a http://ruby.taobao.org/  

     

    //验证是否替换成功

    1. $ gem sources -l  

    //验证结果

    1. *** CURRENT SOURCES ***  
    2.   
    3. http://ruby.taobao.org/  

     //升级gem

    1. $ sudo gem update --system  

     

     

    ③安装完成后,执行pod setup命令时报错:

    1. /Users/wangzz/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:298:in `to_specs': Could not find 'cocoapods' (>= 0) among 6 total gem(s) (Gem::LoadError)  
    2.     from /Users/wangzz/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:309:in `to_spec'  
    3.     from /Users/wangzz/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:53:in `gem'  
    4.     from /Users/wangzz/.rvm/rubies/ruby-1.9.3-p448/bin/pod:22:in `<main>'  

    这就是路径设置的问题,可以通过执行:

    1. $ rvm use ruby-1.9.3-p448 

     

    3、升级CocoaPods

    升级很简单,再次执行安装命令即可:

    1. $ sudo gem install cocoapods  

    需要注意的是,如果安装的时候使用了sudo,升级的时候一样需要使用该关键字,不然升级完了以后又会出现路径不匹配问题。

     

    1、创建Podfile

     

    1. $ cd /Users/wangzz/Desktop/CocoaPodsTest  
    2. $ touch Podfile 

     

    2、编辑Podfile

    1. platform :ios  
    2. pod 'Reachability',  '~> 3.0.0'  
    3. pod 'SBJson''~> 4.0.0'  
    4.   
    5. platform :ios, '7.0'  
    6. pod 'AFNetworking''~> 2.0'  

     

     

    vi  Podfile   打开文件  

    输入i 开始编辑模式

    esc +shift +: 打开输入框

    wq   保存并退出

    3、执行导入命令

     

    $pod  install      执行下载命令

     

    //下载完成

     

    1. Analyzing dependencies  
    2. Downloading dependencies  
    3. Installing AFNetworking (2.1.0)  
    4. Installing JSONKit (1.5pre)  
    5. Installing Reachability (3.0.0)  
    6. Generating Pods project  
    7. Integrating client project  
    8.   
    9. [!] From now on use `CocoaPodsTest.xcworkspace`. 

     

     

     

    pod setup 报CocoaPods was not able to update the `master` repo 错误解决办法

     

    先删除全局的缓存:

    $ sudo rm -fr ~/Library/Caches/CocoaPods/

    $ sudo rm -fr ~/.cocoapods/repos/master/

     

    还不行的话就把当前 Pods 目录清空:

    $ sudo rm -fr Pods/

     

    // 再执行

    $ sudo gem install cocoapods

     

    $ pod setup 

     

     

    1. Unable to find a specification for `xxxxx (~> 1.x.x)` depended upon by Podfile.  

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

    1. pod repo remove master  
    2. pod setup  

    setup成功后执行install或update即可。

  • 相关阅读:
    原生JS之温故而知新(一)
    jQuery版本问题
    AngularJs我的学习整理(不定时修改)
    Js事件处理程序跨浏览器
    AngularJs的关于路由问题
    很棒的十句话,分享给大家。
    一个人为什么要努力?
    春熙路。
    成都
    springboot 使用mybatis-generator自动生成代码
  • 原文地址:https://www.cnblogs.com/xuaninitial/p/4882089.html
Copyright © 2011-2022 走看看