iOS 学习笔记二【cocopods安装使用和安装过程中遇到的问题及解决办法】
2015-11-19 16:14
1606 查看
在osx 10.11之前cocopods问题不多,但是升级到11之后的版本,之前的cocopods大多用不了,需要重新安装,对于我这种使用测试版系统的技术狂来说,每次都需要重新安装很多东西,
当然,cocopods也避免不了安装很多次了。
对于新手来说,使用cocopods开发,还是节省了相当多的开发时间,以下便是cocopods安装和安装过程中遇到的问题及解决办法:
1、cocopods 安装:/article/5219791.html
2、出现以下问题,大家不要慌:
解决办法:
(1)先执行下面两行代码:
sudo gem sources -r https://rubygems.org
sudo gem sources -a http://rubygems.org
(2)执行过程如下:
最后会提示
这就说明成功了,就可以执行下面的安装了。
(3)安装cocopods
执行下面的语句:
sudo gem install cocoapods
会出现下面的界面:(激动。。。)
看到最后一行代码,你就放120个心吧。。。
然后就可以查看你的pods版本了:
输入:pod
然后会出现下面的代码:
这就安装成功了,就可以正常使用pod了。。。
[b]3、接下来就可以在项目中使用了,[/b]
打开终端:
cd 你的项目路径
然后:输入touch podfile
接下来出现:
这就成功了,然后再看看你的项目路径里面,是不是多出来很多文件?
如下图:
然后双击***.workspace 文件就可以使用pods了!
好了,大功告成!
当然,cocopods也避免不了安装很多次了。
对于新手来说,使用cocopods开发,还是节省了相当多的开发时间,以下便是cocopods安装和安装过程中遇到的问题及解决办法:
1、cocopods 安装:/article/5219791.html
2、出现以下问题,大家不要慌:
boai:~ boai$ sudo gem install cocoapods ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why: Unable to download data from http://ruby.taobao.org/ - bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz) boai:~ boai$ sudo gem install cocoapods ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why: Unable to download data from http://ruby.taobao.org/ - bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz) boai:~ boai$ sudo gem update --system ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
解决办法:
(1)先执行下面两行代码:
sudo gem sources -r https://rubygems.org
sudo gem sources -a http://rubygems.org
(2)执行过程如下:
boai:~ boai$ sudo gem sources -r https://rubygems.org source https://rubygems.org not present in cache boai:~ boai$ sudo gem sources -a http://rubygems.org https://rubygems.org is recommended for security over http://rubygems.org Do you want to add this insecure source? [yn] y
最后会提示
Do you want to add this insecure source? [yn] 你选择 y就行了 然后出现:
http://rubygems.org added to sources
这就说明成功了,就可以执行下面的安装了。
(3)安装cocopods
执行下面的语句:
sudo gem install cocoapods
会出现下面的界面:(激动。。。)
boai:~ boai$ sudo gem install cocoapods Fetching: nap-1.0.0.gem (100%) Successfully installed nap-1.0.0 Fetching: thread_safe-0.3.5.gem (100%) Successfully installed thread_safe-0.3.5 Fetching: tzinfo-1.2.2.gem (100%) Successfully installed tzinfo-1.2.2 Fetching: i18n-0.7.0.gem (100%) Successfully installed i18n-0.7.0 Fetching: activesupport-4.2.5.gem (100%) Successfully installed activesupport-4.2.5 Fetching: escape-0.0.4.gem (100%) Successfully installed escape-0.0.4 Fetching: colored-1.2.gem (100%) Successfully installed colored-1.2 Fetching: molinillo-0.4.0.gem (100%) Successfully installed molinillo-0.4.0 Fetching: netrc-0.7.8.gem (100%) Successfully installed netrc-0.7.8 Fetching: cocoapods-trunk-0.6.4.gem (100%) Successfully installed cocoapods-trunk-0.6.4 Fetching: cocoapods-try-0.5.1.gem (100%) Successfully installed cocoapods-try-0.5.1 Fetching: cocoapods-stats-0.6.2.gem (100%) Successfully installed cocoapods-stats-0.6.2 Fetching: cocoapods-search-0.1.0.gem (100%) Successfully installed cocoapods-search-0.1.0 Fetching: cocoapods-plugins-0.4.2.gem (100%) Successfully installed cocoapods-plugins-0.4.2 Fetching: cocoapods-downloader-0.9.3.gem (100%) Successfully installed cocoapods-downloader-0.9.3 Fetching: claide-0.9.1.gem (100%) Successfully installed claide-0.9.1 Fetching: xcodeproj-0.28.2.gem (100%) Successfully installed xcodeproj-0.28.2 Fetching: fuzzy_match-2.0.4.gem (100%) Successfully installed fuzzy_match-2.0.4 Fetching: cocoapods-core-0.39.0.gem (100%) Successfully installed cocoapods-core-0.39.0 Fetching: cocoapods-0.39.0.gem (100%) Successfully installed cocoapods-0.39.0 Parsing documentation for nap-1.0.0 Installing ri documentation for nap-1.0.0 Parsing documentation for thread_safe-0.3.5 Installing ri documentation for thread_safe-0.3.5 Parsing documentation for tzinfo-1.2.2 Installing ri documentation for tzinfo-1.2.2 Parsing documentation for i18n-0.7.0 Installing ri documentation for i18n-0.7.0 Parsing documentation for activesupport-4.2.5 Installing ri documentation for activesupport-4.2.5 Parsing documentation for escape-0.0.4 Installing ri documentation for escape-0.0.4 Parsing documentation for colored-1.2 Installing ri documentation for colored-1.2 Parsing documentation for molinillo-0.4.0 Installing ri documentation for molinillo-0.4.0 Parsing documentation for netrc-0.7.8 Installing ri documentation for netrc-0.7.8 Parsing documentation for cocoapods-trunk-0.6.4 Installing ri documentation for cocoapods-trunk-0.6.4 Parsing documentation for cocoapods-try-0.5.1 Installing ri documentation for cocoapods-try-0.5.1 Parsing documentation for cocoapods-stats-0.6.2 Installing ri documentation for cocoapods-stats-0.6.2 Parsing documentation for cocoapods-search-0.1.0 Installing ri documentation for cocoapods-search-0.1.0 Parsing documentation for cocoapods-plugins-0.4.2 Installing ri documentation for cocoapods-plugins-0.4.2 Parsing documentation for cocoapods-downloader-0.9.3 Installing ri documentation for cocoapods-downloader-0.9.3 Parsing documentation for claide-0.9.1 Installing ri documentation for claide-0.9.1 Parsing documentation for xcodeproj-0.28.2 Installing ri documentation for xcodeproj-0.28.2 Parsing documentation for fuzzy_match-2.0.4 Installing ri documentation for fuzzy_match-2.0.4 Parsing documentation for cocoapods-core-0.39.0 Installing ri documentation for cocoapods-core-0.39.0 Parsing documentation for cocoapods-0.39.0 Installing ri documentation for cocoapods-0.39.0 Done installing documentation for nap, thread_safe, tzinfo, i18n, activesupport, escape, colored, molinillo, netrc, cocoapods-trunk, cocoapods-try, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, claide, xcodeproj, fuzzy_match, cocoapods-core, cocoapods after 21 seconds WARNING: Unable to pull data from 'http://ruby.taobao.org/': bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz) 20 gems installed
看到最后一行代码,你就放120个心吧。。。
然后就可以查看你的pods版本了:
输入:pod
然后会出现下面的代码:
boai:~ boai$ pod Usage: $ pod COMMAND CocoaPods, the Cocoa library package manager. Commands: + cache Manipulate the CocoaPods cache + init Generate a Podfile for the current directory. + install Install project dependencies to Podfile.lock versions + ipc Inter-process communication + lib Develop pods + list List pods + outdated Show outdated project dependencies + plugins Show available CocoaPods plugins + repo Manage spec-repositories + search Search for pods. + setup Setup the CocoaPods environment + spec Manage pod specs + trunk Interact with the CocoaPods API (e.g. publishing new specs) + try Try a Pod! + update Update outdated project dependencies and create new Podfile.lock Options: --silent Show nothing --version Show the version of the tool --verbose Show more debugging information --no-ansi Show output without ANSI codes --help Show help banner of specified command boai:~ boai$
这就安装成功了,就可以正常使用pod了。。。
[b]3、接下来就可以在项目中使用了,[/b]
打开终端:
cd 你的项目路径
boai:~ boai$ cd /Users/boai/Documents/博爱项目/BAPDCViewTest
然后:输入touch podfile
boai:BAPDCViewTest boai$ touch podfile boai:BAPDCViewTest boai$ pod install
接下来出现:
Last login: Fri Nov 20 11:02:59 on ttys006
boai:~ boai$ cd /Users/boai/Documents/博爱项目/BAPDCViewTest
boai:BAPDCViewTest boai$ touch podfile boai:BAPDCViewTest boai$ pod install
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `BAPDCViewTest.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 0 dependencies from the Podfile and 0 total
pods installed.
[!] [!] The Podfile does not contain any dependencies.
boai:BAPDCViewTest boai$
这就成功了,然后再看看你的项目路径里面,是不是多出来很多文件?
如下图:
然后双击***.workspace 文件就可以使用pods了!
好了,大功告成!
相关文章推荐
- iOS中的核心框架
- iOS生命周期之WillTerminate不执行的问题
- iOS SDK 集成指南
- iOS开发之MD5封装及应用
- iOS设置同一个Label的不同颜色的字体
- iOS 9 适配中出现的坑
- iOS检测耳机插入拔出
- 【转】ios开发之生成所缩略图方式
- iOS系统的这些小功能会影响到你的APP哦~你测了没呢?
- IOS创建弹出层
- 证书制作,各个环节的原理以及推送证书制作,和如何为推送服务器提供证书
- IOS 图片失真
- iOS---错误合集
- ios 定位
- 关于NSURLSession之NSURLSessionConfiguration
- iOS 处理图片的一些小 Tip
- iOS中 XMPP即时通讯实现的主要步骤
- 关于iOS去除数组中重复数据的几种方法
- iOS 账号申请流程
- iOS获取设备的语言