用CocoaPods导入框架出现的问题

当你拿到别人的代码在自己的电脑上运行的时候,有时候会发现用CocoaPods导入的框架报错了,例如AFNetworking框架。下面是一些可能出现的一些错误整合:

pod install 后出现的问题:
$ pod install 
Analyzing dependencies 
[!] Unable to satisfy the following requirements: 
-AFNetworking (~> 3.0) required by Podfile 
None of your spec sources contain a spec satisfying the dependency: AFNetworking (~> 3.0). 
You have either: 
* out-of-date source repos which you can update with pod repo update. 
* mistyped the name or version. 
* not added the source repo that hosts the Podspec to your Podfile. 
Note: as of CocoaPods 1.0, pod repo update does not happen on pod install by default.

解决办法

$ pod repo remove master
$ pod repo add master https://gitcafe.com/akuandev/Specs.git
$ pod repo update

$ pod repo add master https://gitcafe.com/akuandev/Specs.git有可能出现错误,就用pod setup,如果用pod setup卡住,那么可以用如下的方式:
1,cd ~/.cocoapods //进到安装cocoa pod 的repo目录
2,open . //打开目录此时里面应该是空的啥也没有
具体的操作方式

具体操作。 
cd ~/.cocoapods/repos 
git clone https://github.com/CocoaPods/Specs.git master
这个命令需要的时间是很长的,如果中间出现错误:
Cloning into ‘master’… 
error: RPC failed; curl 56 SSLRead() return error -36 
fatal: The remote end hung up unexpectedly 
fatal: early EOF 
fatal: index-pack failed 
解决办法
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
如果你安装了多个xcode,命令需要修改一下
$ sudo xcode-select -switch /Applications/Xcode 7.3.1.app/Contents/Developer
在重新执行git clone https://github.com/CocoaPods/Specs.git master这个命令,完成以后,就可以pod install了
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容