cocoa pods的安装与我遇到的问题

1.打开终端

终端输入  ruby -v  查看ruby的版本

打印代码:

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

 

 

2. 更换ruby镜像

终端输入如下命令(把Ruby镜像指向taobao,避免被墙,你懂得)

a.移除现有 Ruby 默认源输入以下指令

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

b.使用新的源输入以下指令 

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

c.验证新源是否替换成功输入以下指令 

gem sources -l  (用来检查使用替换镜像位置成功)

打印代码:

bogon:~ LiuWenqiang$ gem sources --remove https://rubygems.org/
source https://rubygems.org/ not present in cache
bogon:~ LiuWenqiang$ gem sources -a https://ruby.taobao.org/
source https://ruby.taobao.org/ already present in the cache
bogon:~ LiuWenqiang$ gem sources -l
*** CURRENT SOURCES ***

 

 

3.安装cocoapods

终端   sudo gem install cocoa pods

这就遇到我的第一个问题:

如果你的ruby 版本过低 就会报错:

ERROR:  Error installing cocoa:activesupport requires Ruby version >= 2.2.2.
ERROR:  Error installing pods:activesupport requires Ruby version >= 2.2.2.

前几天,我就搞到这个地方,尝试了好几种方法更新ruby 但是都没有成功,今天偶然看到一个文章,(有种淡淡的忧伤:http://www.jianshu.com/p/ad98a3364803

)并得到作者的帮助,才得以解决

解决方案:

(1)安装 RVM baby 版本管理器 

\curl -sSL https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash

打印代码:

In case of problems: https://rvm.io/help and https://twitter.com/rvm_io

说明安装成功

(2)

source ~/.bashrc  

source ~/.bash_profile  

rvm -v  

打印代码:

rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

(3)用RVM升级Ruby查看当前ruby版本

ruby -v 

rvm list known

打印代码:

复制代码
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.8]
[ruby-]2.2[.4]
[ruby-]2.3[.0]
[ruby-]2.2-head
ruby-head# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2

# JRuby
jruby-1.6[.8]
jruby-1.7[.23]
jruby[-9.0.5.0]
jruby-head# Rubinius
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx[-2.5.8]
rbx-head
复制代码

(4)安装ruby 2.2.2 版本

rvm install 2.2.2

如果打印:

复制代码
……  ruby-2.2.2 - #validate archiveruby-2.2.2 - #extractruby-2.2.2 - #validate binaryruby-2.2.2 - #setupruby-2.2.2 - #gemset created /Users/abc/.rvm/gems/ruby-2.2.2@globalruby-2.2.2 - #importing gemset             
/Users/abc/.rvm/gemsets/global.gems..............................ruby-2.2.2 - #generating global wrappers........ruby-2.2.2 - #gemset created /Users/abc/.rvm/gems/ruby-2.2.2ruby-2.2.2 - #importing gemsetfile /Users/abc/.rvm/gemsets/default.gems
  evaluated to empty gem list ruby
-2.2.2 - #generating default wrappers........Updating certificates in '/etc/openssl/cert.pem'.mkdir: /etc/openssl: Permission deniedmkdir -p "/etc/openssl" failed, retrying with sudoLiuWenqiang password required for 'mkdir -p /etc/openssl': and sudo mkdir worked
复制代码

 则说明安装成功了

打印代码:

复制代码
Done with Command Line Tools (OS X 10.11) for Xcode
Done.
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> Installing the Command Line Tools (expect a GUI popup):
==> /usr/bin/sudo /usr/bin/xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Failed during: /usr/bin/sudo /usr/bin/xcode-select --install
Requirements installation failed with status: 1.
复制代码

如果安装失败 

 

(5)查看当前ruby 版本

ruby -v

    ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]

现在ruby版本已经是2.2.2了

第一个问题就解决了

 

 

4.  继续安装 CocoaPods

sudo gem install cocoa pods

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

pod setup

 

5.  更新 gem

sudo gem update --system

 

6 新建一个项目,名字PodTest

 

7.    $ cd  项目路径 (中间有空格,)

    cd /Users/lucky/Desktop/PodTest   

 

8.   建立Podfile(配置文件)

    vim Podfile

键盘输入 i 进入编辑模式,输入

platform :ios, '7.0' 

pod 'MBProgressHUD', '~> 0.8’ (之前的,我的电脑上已经无效了,报错: [!] The dependency `MBProgressHUD (~> 0.8)` is not used in any concrete target.)

(现在使用:MyApp 替换成自己的项目名)

target 'MyApp' do

pod 'AFNetworking', '~> 2.6'

pod 'ORStackView', '~> 3.0'

end

 

 

 

 

然后按Esc,并且输入“ :”号进入vim命令模式,然后在冒号后边输入wq

 

再输入  pod install

 

注意:现在打开项目不是点击 PodTest.xodeproj了,而是点击 PodTest.xcworkspace

 

为了确定AFNetworking是否支持CocoaPods,可以用CocoaPods的搜索功能验证一下。在终端中输入:

pod search AFNetworking

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/458633.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Node 连接Mysql并进行增删改查

NPM: NPM的全称是Node Package Manager&#xff0c;类似于ruby的gem&#xff0c;Python的PyPL、setuptools&#xff0c;PHP的pear&#xff0c;是Nodejs中的包管理器。Nodejs自身提供了基本的模块。但是在这些基本模块上开发实际应用需要较多的工作。NPM上已经有近万个Nodejs库或…

C++/C 宏定义(define)中# ## 的含义(转)

参考&#xff1a;http://www.cnblogs.com/little-ant/p/3463080.html http://hi.baidu.com/kiraversace/item/1148ee057147981a4ac4a3e9 C/C 宏定义&#xff08;define&#xff09;中# ## 的含义 define 中的# ## 一般是用来拼接字符串的&#xff0c;但是实际使用过程中&#x…

Implicit declaration of function 'NSFileTypeForHFSTypeCode' is invalid in C99

一般出现该问题是因为通过C调用了unix/linux 底层接口&#xff0c;所以需要调整c语言的编译选项&#xff0c;设置方法见下图&#xff1a;(根据实际情况选择相应的编译选项)

C++里的花括号{},块,作用域

{ } 里的内容是一个“块”。单独的{ }在执行顺序上没有改变&#xff0c;仍然是顺序执行&#xff0c;不同的是标识符的作用域限定 。#include <iostream>#include <string>using namespace std;class tcalss{string Name;public:tcalss(string name){Namename;cout&…

iOS关于armv7,armv7s,arm64,i386,x86_64等问题

iOS测试分为模拟器测试和真机测试&#xff0c;处理器分为32位处理器&#xff0c;和64位处理器&#xff0c; 模拟器32位处理器测试需要i386架构&#xff0c;&#xff08;iphone5,iphone5s以下的模拟器&#xff09; 模拟器64位处理器测试需要x86_64架构&#xff0c;(iphone6以上的…

DebugView 调试入门

参考链接&#xff1a;http://blog.csdn.net/jiankunking/article/details/44984487 软件下载地址&#xff1a;点击打开链接 debugview 可以捕获程序中由TRACE(debug版本)和OutputDebugString输出的信息。支持Debug、Release模式编译的程序&#xff08;即该软件捕获的是exe直接运…

AJAX只支持字符类数据返回,不支持文件下载

如题转载于:https://www.cnblogs.com/caicaizi/p/5000363.html

Xcode中指令集相关选项

Xcode中指令集相关选项&#xff08;Build Setting中&#xff09; &#xff08;1&#xff09;Architectures Space-separated list of identifiers. Specifies the architectures (ABIs, processor models) to which the binary is targeted. When this build setting specifies…

DebugView使用笔记

1. 什么是DebugView? 它是Sysinternals公司的系列调试工具。可以捕获程序中由TRACE()和OutputDebugString输出的信息。 2. C需要完成哪些工作呢&#xff1f; 将打印的信息用OutputDebugString输出&#xff0c;示例&#xff1a; [cpp] view plaincopy #include "stdio.h&q…

DebugView的使用[通用汇总]

DebugView是一款免费辅助工具&#xff0c;用来输出捕捉OutputDebugString()函数输出的信息等。 1 下载 http://technet.microsoft.com/en-us/sysinternals/bb896647 1.1 介绍DebugView http://www.vcfans.com/2008/11/trace-show-about-a-tool-debugview-sent-a-message-to-tra…

Android 通信 EventBus

参考&#xff1a; Android 框架炼成 教你如何写组件间通信框架EventBusAndroid EventBus源码解析 带你深入理解EventBusAndroid EventBus实战 没听过你就out了快速Android开发系列通信篇之EventBusEventBus是一个publish/subscribe (发布 / 订阅) 消息的总线&#xff0c;简化了…

WIFI无线路由器的五种工作模式

http://www.360doc.com/content/12/0814/08/10560798_230064460.shtml

iOS面试题1

而技术开发面试&#xff0c;问一些技术相关的问题是必须的&#xff0c;最新的技术可能人人都趋之若鹜&#xff0c;但有些原理和基础的也希望都有了解。 这里整理了一些iOS相关的面试题&#xff0c;&#xff08;可能都已经老掉牙&#xff09;但是也想跟大家分享下&#xff01; 如…

高质量JAVA代码编写规范

1. Java 命名约定   除了以下几个特例之外&#xff0c;命名时应始终采用完整的英文描述符。此外&#xff0c;一般应采用小写字母&#xff0c;但类名、接口名以及任何非初始单词的第一个字母要大写。 1.1 一般概念   * 尽量使用完整的英文描述符   * 采用适用于相关领域的…

MFC中绘制动态曲线

参考&#xff1a; http://blog.csdn.net/zang141588761/article/details/50536788 [转载]MFC中画直线和曲线 一、画直线要想在MFC中画出有颜色的线条&#xff0c;首先就要设置DC的画笔&#xff0c;我们可以按如下方法来设置画笔&#xff1a;第一步&#xff1a;在View类中添加…

博客地址 RSS地址

博客地址 RSS地址 OneVs Den http://onevcat.com/atom.xml 破船之家 http://beyondvincent.com/atom.xml NSHipster http://nshipster.cn/feed.xml Limboy 无网不剩 http://feeds.feedburner.com/lzyy 唐巧的技术博客 http://blog.devtang.com/atom.xml Lex iOS notes http://i…

2015.11.27---Java

public class star{public static void main(String[] args) {System.out.print("ha");}}转载于:https://www.cnblogs.com/supermeimei/p/5001922.html

QT之深入理解QThread

QT之深入理解QThread 理解QThread之前需要了解下QThread类&#xff0c;QThread拥有的资源如下&#xff08;摘录于QT 5.1 帮助文档&#xff09;&#xff1a;在以上资源中&#xff0c;本文重点关注槽&#xff1a;start()&#xff1b;信号&#xff1a;started()、finished()&#…

常见人事问题

整体素养的常见问题 一、请你自我介绍一下你自己&#xff1f; &#xff08;面试官目的&#xff1a;深度了解求职者&#xff0c;看求职者基本的沟通和自我认知能力&#xff09; NO: 只说姓名、年龄、爱好等基本的信息后就没了。只重复简历里的内容&#xff0c;如工作经验就…

springMVC数据封装成POJO

springMVC把前台的数据封装为POJO与struts2的封装形式不同。struts2需要在控制器声明需封装的POJO&#xff0c;而springMVC不需要任何准备工作&#xff0c;只需在相应的方法的参数中加上需封装的POJO&#xff0c;当用户提交表单时&#xff0c;springMVC会根据表单中dom元素的na…