CocoaPods 使用简录

CocoaPods 作为方便的第三方库文件管理软件 在iOS开发的过程中还是很方便的。为了方便记忆防止遗忘 小结如下。

更改镜像

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

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

查看

gem sources -l

只有在终端中出现下面文字才表明你上面的命令是成功的:

*** CURRENT SOURCES ***

https://ruby.taobao.org/

安装cocoa pods

sudo gem install cocoa pods

会跟你要电脑密码 输完之后 出现下面的表示成功安装

Successfully installed cocoapods-0.39.0

Parsing documentation for cocoapods-0.39.0

1 gem installed



遇到的坑

$ gem sources -l

会出现

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/rbconfig.rb:213: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

有时候在运行Ruby脚本时会出现上述警告信息,有碍视听。这是因为/usr/local/bin这个目录对other用户具有write权限,可能会有潜在的安全性问题。

该怎么做呢

cd /usr

sudo chmod 775 local

去改变他的权限就好了。

sudo chmod go-w /usr/local/bin

gem sources -l发现没有了 是不是。

接着可以进行操作了。

pod setup 

Setting up CocoaPods master repo 出现这个的时候不要慌 等一会吧。具体要等多少时间不一定。视网速而定。不一会就会出现下面的信息

CocoaPods 1.0.0.beta.7 is available.

To update use: `gem install cocoapods --pre`

[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org

and the CHANGELOG for this version http://git.io/BaH8pQ.

Setup completed

到你的新建的工程目录下面去进行操作吧。

---新建文件 vim “Podfile”,

vim Podfile

写入以下内容并保存 

platform:ios, '6.0'

pod 'AFNetworking', '~> 2.0‘

(终端vim文件 按 i 可编辑 ,esc 退出编辑,按住shift+: 然后wq  可保存退出)

---导入第三方库

pod install

Updating local specs repositories会出现这些 稍等片刻会出现

CocoaPods 1.0.0.beta.7 is available.

To update use: `gem install cocoapods --pre`

[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org

and the CHANGELOG for this version http://git.io/BaH8pQ.

Analyzing dependencies

Downloading dependencies

Installing AFNetworking (2.6.3)

Generating Pods project

Integrating client project

[!] Please close any current Xcode sessions and use `cocoaPodsTest.xcworkspace` for this project from now on.

Sending stats

Pod installation complete! There is 1 dependency from the Podfile and 1 total

pod installed.

快去你的工程目录里面查看吧,是不是已经导入 了呢 

ps:水平有限,还望大神多多指教;



鸣谢:网络上的各位大神给提供的思路

参考文章:


http://blog.csdn.net/showhilllee/article/details/38398119

http://www.tuicool.com/articles/7VvuAr3


你可能感兴趣的:(CocoaPods 使用简录)