,1.客户端不好用,环境装坏了,卸掉,客户端资料没多少。
2.全部卸载干净,然后重新安装。
3.卸载参考http://www.meetrue.com/archives/133
4.只跟着做卸载,可以去对应路径看看有没有删掉,卸载完了不要继续.
5.更换淘宝镜像 参考
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
gem sources -l
http://blog.devtang.com/2014/05/25/use-cocoapod-to-manage-ios-lib-dependency/#jtss-douban
6.更换完使用 sudo gem install cocoapods
7. 报错SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
这个的意思是证书无效,因为淘宝现在是https网站了需要证书,但是没找到证书不能访问,
8. 首先保证淘宝网站可以访问,不能访问我也没办法
9. 报错解决 http://stackoverflow.com/questions/4528101/ssl-connect-returned-1-errno-0-state-sslv3-read-server-certificate-b-certificat
10.
11. 大意是前面解决方案全是windows环境下的,osx不需要那么麻烦,只要把安装那句话换成
12. rvm install 2.2.2 --disable-binary
13. 如果你已经安装过了,那么换成重装
14. rvm reinstall 2.2.2 --disable-binary
15. 遇到至少2.2的版本可能是没装rvm 按照rvm的命令curl -sSL https://get.rvm.io | bash -s stable
装完记得source /Users/yeyifan/.rvm/scripts/rvm
也有可能提示没有homebrew环境,但是我装homebrew的时候提示了已经安装过了,再重新看问题,发现make sure
brew updateworks before continuing
这句话 ,于是跑brew update
提示 Error: /usr/local must be writable!
原来是没有权限,赶紧改权限, 给对应的文件夹把锁打开,然后把自己那个改成读与写 再重新brew update
就好了。
15. ERROR: Error installing cocoapods:
。
activesupport requires Ruby version >= 2.2.2.
16.
17.
16. 安装进度取决于网速
17. 继续pod setup
显示 pod: command not found
18. 解决http://www.jianshu.com/p/6ff1903c3f11
19. 原因是MAC电脑版本变高了,路径不一样了,要卸载pod重装绝对路径
20.sudo gem install -n /usr/local/bin cocoapods
使用这个命令,安装cocopods的时候提示最少要rvm 2.2以上的版本,刚才装错的重装。
21. 这时候pod setup
能用了 显示信息Setting up CocoaPods master repo
22. cmd+n 新开一个终端cd ~/.cocoapods
23. du -sh
看下载进度,很大的文件大概800M,别退了,退了就坑自己,要等很久……………………………………………………………………..
24. 等了一小时,,,先暂时保存文档
25.
26.看下下载了多大,794M
27.看看下载的对不对,搜索一下pod search AFN
28.到这里基本上环境就算搭建好了,可以搜索出来最新版本的库
29.接下来找一个简单的工程试试看能否导入 cd 到工程文件根目录下
30.vim Podfile
31.文件内容格式
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'BaiduMapKit', '~> 3.0.0'
end
https://cocoapods.org 官方提倡这种格式
保存退出 wq ,
一般会安装这个版本最后一个 这里是 会安装2.5.4 版本。
pod install
等待安装完成- 打开.xcworkspace
- 发现各种奇怪的报红
这个我每个都试了一遍都没什么卵用,网上没有正确解答。
因为xode版本问题,请升级xcode
35.虽然报红但是可以编译通过的办法,选择manage scheme
每个库都点一下play
可以测试一下了
#import "ViewController.h"
#import "AFNetworking.h"
#import "UIImageView+WebCache.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[imageV sd_setImageWithURL:[NSURL URLWithString:@"https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/logo_white_fe6da1ec.png"]];
[self.view addSubview:imageV];
}
@end
36.编译运行成功,总结一下,最好按顺序来,不然问题出了不晓得是哪一步出错。
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
使用 pod search 功能的时候出错
错误信息
macdeiMac:~ mac$ pod search afn
/Users/mac/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'cocoapods' (>= 0) among 22 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/mac/.rvm/gems/ruby-2.2.0:/Users/mac/.rvm/gems/ruby-2.2.0@global', execute `gem env` for more information
from /Users/mac/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
from /Users/mac/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /usr/local/bin/pod:22:in `<main>'
from /Users/mac/.rvm/gems/ruby-2.2.0@global/bin/ruby_executable_hooks:15:in `eval'
from /Users/mac/.rvm/gems/ruby-2.2.0@global/bin/ruby_executable_hooks:15:in `<main>'
macdeiMac:~ mac$ rvm use 2.2.2 --default
注意到有个路径地址
/Users/mac/.rvm/gems/ruby-2.2.0
进去看看
2.2.0里没装pod 的 2.2.2 才安装了pod
解决思路:
1.我删掉 了2.2.0的RVM 没鸟用,路径还是保持着2.2.0的路径,还原。
2.卸载掉全部RVM重装RVM重装Cocopod——费力气
3.查看一下rvm的命令——发现一个 命令rvm use 2.2.2 --default
使用第三种方案成功。