xcode7.0 后 cocoapods的安装

CocoaPods安装失败

CocoaPods安装东西的时候它要找到Xcode的Developer文件夹, 如果找不到会报如下错误

解决方案

gaoshuai替换为你自己的用户名 ```objc

sudo xcode-select --switch /Users/gaoshuai/Applications/Xcode.app/Contents/Developer ```

CocoaPods安装过程

最近在安装SASS的时候,用到gem命令,但是运行出行如下错误!

C:\Users\len>gem install sass

ERROR:  While executinggem ... (Gem::RemoteFetcher::FetchError)

Errno::ETIMEDOUT: A connection attempt failed because the connected partydi

d not properly respond after a period of time, or established connectionfailed

because connected host has failed to respond. - connect(2) for "rubygems.global.

ssl.fastly.net" port 443 (https://api.rubygems.org/quick/Marshal.4.8/sass-3.4.13

.gemspec.rz)

原因是ruby 的gem被和谐了,现在淘宝的ruby工程师架设了rubygems的国内镜像。使用方法如下:

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

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

$ gem sources -l

*** CURRENT SOURCES ***

https://ruby.taobao.org

Xcode7.0以前

+ 更新ruby的软件源

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

* gem sources -a http://ruby.taobao.org/

* gem sources -l

Xcode7.0以后

+ 更新ruby的软件源

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

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

* gem sources -l

+ 安装CocoaPods

* sudo gem install cocoapods

+ 替换CocoaPods的镜像索引

* pod repo remove master

* pod repo add master http://git.oschina.net/akuandev/Specs.git

*  pod repo add master https://gitcafe.com/akuandev/Specs.git

* pod repo update

+ 设置 pod 仓库

* pod setup

+ 测试

* pod --version

- 卸载CocoaPods

+ sudo gem uninstall cocoapods

- CocoaPods使用:

+ 使用时需要新建一个名为Podfile的文件

+ 将依赖的库名字依次列在文件中

```

platform:ios

pod'AFNetworking'

```

- 注释事项

+ 1.利用CocoPods管理类库后, 以后打开项目就用xxxx.xcworkspace 打开,而不是之前的.xcodeproj文件

+ 2.每次更改了Podfile文件,你需要重新执行一次pod update命令。

+ 3.CocoaPods在执行pod install和pod update时,会默认先更新一次CocoPods的 spec仓库索引。使用--no-repo-update参数可以禁止其做索引更新操作

```

podinstall --no-repo-update

podupdate --no-repo-update

```

你可能感兴趣的:(xcode7.0 后 cocoapods的安装)