CocoaPods安装流程以及常见错误
2016-08-12 16:51
495 查看
一、 CocoaPods 安装流程
(1)CocoaPods的使用淘宝的Ruby镜像替换官方的ruby源,在终于输入命令
$ gem sources --remove https://rubygems.org/ $ gem sources -a https://ruby.taobao.org/ $ gem sources -l
如果结果为下面的样子,说明替换成功了。
***CURRENT SOURCES *** https://ruby.taobao.org/[/code](2)升级gem,在终端输入命令
$ sudo gem update --system
接着会要求输入电脑密码,输入密码后回车,就开始升级了。如果看到下面这句话,说明升级成功了。RubyGems system software updated(3)安装CocoaPods,在终端输入命令
$ sudo gem install cocoapods
输入密码后开始安装。二、CocoaPods的使用
(1)查找第三方库,在终端输入命令:如
$ pod search AFNetworking
会显示出AFNetworking相关的库Creating search index for spec repo 'master'.. Done! - Versions: 0.0.2, 0.0.1 [master repo] -> AFHARchiver (0.2.2) An AFNetworking extension to automatically generate a HTTP Archive file of all of your network requests. pod 'AFHARchiver', '~> 0.2.2' - Homepage: https://github.com/mutualmobile/AFHARchiver - Source: https://github.com/mutualmobile/AFHARchiver.git - Versions: 0.2.2, 0.2.1, 0.2.0, 0.1.0, 0.0.2, 0.0.1 [master repo] -> AFHTTPClientLogger (0.7.0) AFNetworking Extension for request logging. pod 'AFHTTPClientLogger', '~> 0.7.0' - Homepage: https://github.com/jparise/AFHTTPClientLogger - Source: https://github.com/jparise/AFHTTPClientLogger.git - Versions: 0.7.0, 0.6.1, 0.6.0, 0.5.0 [master repo](2)在工程中创建一个Podfile文件,在终端输入命令
$cd /Users/jh/Desktop/project/CocoaPods $ touch Podfile
备注:/Users/jh/Desktop/project/CocoaPods为需要安装库文件项目的路径,根据自己的实际情况而定!(3)使用Xcode打开Podfile,然后按如下格式编辑Podfile,保存。
# Uncomment this line to define a global platform for your project # platform :ios, '9.0' pod "AFNetworking", "~> 2.5.4" pod 'SDWebImage' pod 'KVNProgress' target 'CocoaPods' do # Uncomment this line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Pods for CocoaPods end(4)安装第三方库,在终端输入命令
$ pod install三、可能遇到的问题
(1)使用cocoapods导入第三方类库后头文件没有代码提示?
解决办法: 选择Target -> Build Settings 菜单,找到\”User Header Search Paths\”设置项,新增一个值”${SRCROOT}”,并且选择\”Recursive\”(2)出现如下警告
[!] Your Podfile has had smart quotessanitised. To avoid issues in the future, you should not use TextEdit forediting it. If you are not using TextEdit, you should turn off smart quotes inyour editor of choice.
解决办法:不要使用文本编辑去编辑Podfile,使用Xcode编辑,或者使用终端敲命令去编辑。(3)执行pod install 或pod update 命令后,updating local specsrepositories 卡住不动
解决办法:pod install 被墙了,换成新的命令pod install –verbose –no-repo-update(4)项目运行时报错:
Thefile “Pods.xcconfig” couldn’t be opened because there is no such file.
解决办法:pod update就可以了。(5)在运行“sudo gem install cocoapods” 的时候出现问题:
ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/fuzzy_match
则可以改为:sudo gem install -n /usr/local/bin cocoapods
相关文章推荐
- Ubuntu,Mysql二进制安装流程以及常见错误
- iOS-cocoapods安装与使用以及常见错误
- 程序员面试金典第一章 面试流程以及面试时十大常见错误
- extmail 服务器搭建以及常见安装错误
- mysql Community Server 5.7安装教程以及常见错误
- Ubuntu下安装npm以及常见错误情况解决
- CocoaPods安装,使用以及错误信息
- MySQL安装以及常见的安装错误
- Linux下安装Tomcat7以及常见错误
- CocoaPods 的详细安装步骤,使用方法以及安装过程中出现的各种错误总结
- CocoaPods安装和使用以及常见问题的解答
- ElasticSearch 5.X安装部署常见错误以及解决办法
- heartbeat 安装以及常见错误解决
- CocoaPods 安装 使用&常见操作错误
- CocoaPods详解——安装和使用以及可能遇到的错误
- ElasticSearch-安装以及常见错误
- tensorflow-入门-01-Ubuntu安装tensorflow以及常见错误libcudnn.Version cannot open shared object file No such
- 安卓app开发之Basic4android软件安装配置以及常见错误