通过Podfile.lock
文件查看,文本形式打开Podfile.lock,最后一行版本显示COCOAPODS: 1.2.1
有时候不同的电脑上的版本也是不一致的,低版本容易出现不兼容的问题,有把别人的pod项目在自己电脑上跑过的伙伴们应该亲身有体验,各种报错。
- 查看版本
pod --version
- 查看Ruby源地址gem source -l
- 会打出电脑目前安装的镜像源,https://ruby.taobao.org/,有的则是https://gems.ruby-china.com/,
- 运行sudo gem install cocoapods org结尾的地址可能报错,因为域名已经改成com了,
- 发现运行命令报错,原因是https://gems.ruby-china.org/地址找不到
用浏览器打开https://gems.ruby-china.org/,服务域名更换公告
因域名备案问题,.org 域名无法继续提供 RubyGems 镜像服务,我们提供 .com 代替 .org 的域名,其他一切不变!!
详情访问
-
删除失效的镜像源
gem sources --remove https://gems.ruby-china.org/
-
出现source https://gems.ruby-china.org/ not present in cache 或者
https://gems.ruby-china.org/ removed from sources
- 添加可用的源
gem sources -a https://gems.ruby-china.com
出现 source https://gems.ruby-china.com already present in the cache或者
https://gems.ruby-china.com added to sources
- 再次查看当前源至此,ruby源已经更新成功!
-
安装升级pod
运行命令
sudo gem install cocoapods 输入本机密码
-
多个
gems installed (1分钟左右)pod --version
高版本,比之前电脑上的高就代表成功了,
- 最后,别忘了切到工程目录下,重新
pod install(
pod update)
一下 -
- SDKdemo导入pod 'YYKit' 实现服务器返回文字自动这行。导入//#import "NSString+YYAdd.h" 文件就是找不到,//#import <NSString+YYAdd.h> 这个虽然不报错,看起来找到了,可运行了用里面的方法直接崩溃,后来导入库上层文件#import <YYKit/YYKit.h> 才得以解决,原因说是编译设置下这个库