Xcode中安装CocoaPods
来源:互联网 发布:网络存储器 编辑:程序博客网 时间:2024/06/03 22:51
注:本文是在Mac电脑中已经安装完成好Ruby环境的前提下进行的。xcode版本7.0.1
1.修改Ruby镜像
因为cocoapods.org已经被屏蔽了,使用源网站的话要翻过去。所有为了保证下载的速度,需要切换Ruby镜像。
先删除cocoapods.org镜像:
$gem sources –remove https://rubygems.org/
$gem sources –a https://ruby.taobao.org/ (注:网上很多教程使用的是http://ruby.taobao.org/,但是淘宝已经停用了http服务的协议,需要使用https协议代替)
$gem sources –l (用该命令查看ruby镜像是否是taobao.com)
显示:
*** CURRENT SOURCES ***
https://ruby.taobao.org/
2.安装CocoaPods
$sudo gem install cocoapods
输入完密码后即开始安装。
3.验证CocoaPods是否安装成功
$ pod
localhost:~ fudong$ 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
localhost:~ fudong$
localhost:~ fudong$ pod search "AFNetworking"
第一次搜索的时候会出现Setting up CocoaPods master repo,然后终端会卡住,这是正常情况,说明在下载一些信息,打开另一个终端输入:
localhost:~ fudong$ cd ~/.cocoapods
localhost:.cocoapods fudong$ du -sh *
279M repos
localhost:.cocoapods fudong$
localhost:~ fudong$ pod search "AFNetworking"
-> AFNetworking (3.0.0-beta.2)
A delightful iOS and OS X networking framework.
pod 'AFNetworking', '~> 3.0.0-beta.2'
- Homepage: https://github.com/AFNetworking/AFNetworking
- Source: https://github.com/AFNetworking/AFNetworking.git
- Versions: 3.0.0-beta.2, 3.0.0-beta.1, 2.6.3, 2.6.2, 2.6.1, 2.6.0, 2.5.4, 2.5.3,
2.5.2, 2.5.1, 2.5.0, 2.4.1, 2.4.0, 2.3.1, 2.3.0, 2.2.4, 2.2.3, 2.2.2, 2.2.1, 2.2.0,
2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 2.0.0-RC3, 2.0.0-RC2, 2.0.0-RC1, 1.3.4, 1.3.3,
1.3.2, 1.3.1, 1.3.0, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0, 1.0RC3, 1.0RC2, 1.0RC1,
0.10.1, 0.10.0, 0.9.2, 0.9.1, 0.9.0, 0.7.0, 0.5.1 [master repo]
- Subspecs:
- AFNetworking/Serialization (3.0.0-beta.2)
- AFNetworking/Security (3.0.0-beta.2)
- AFNetworking/Reachability (3.0.0-beta.2)
- AFNetworking/NSURLSession (3.0.0-beta.2)
- AFNetworking/UIKit (3.0.0-beta.2)
-> AFNetworking+AutoRetry (0.0.5)
Auto Retries for AFNetworking requests
pod 'AFNetworking+AutoRetry', '~> 0.0.5'
- Homepage: https://github.com/shaioz/AFNetworking-AutoRetry
- Source: https://github.com/shaioz/AFNetworking-AutoRetry.git
- Versions: 0.0.5, 0.0.4, 0.0.3, 0.0.2, 0.0.1 [master repo]
localhost:~ fudong$ cd Desktop/FDCocoaPods/
localhost:FDCocoaPods fudong$ vi Podfile
localhost:FDCocoaPods fudong$
pod "AFNetworking","~> 2.0"
localhost:FDCocoaPods fudong$ pod install
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (2.6.3)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `FDCocoaPods.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total
pod installed.
localhost:FDCocoaPods fudong$
6.在xcode中添加配置
在项目配置中找到Build Settings-->User Header Search Paths中双击添加一个新的项目 添加上“#(PODS_ROOT)”,第二个选项选中recursive
添加完成之后到文件中就可以导入AFNetworking头文件了。
至此,CocoaPods安装与使用结束。
- Xcode中安装CocoaPods
- Xcode-Cocoapods安装
- Xcode安装CocoaPods
- 在xcode中使用cocoapods
- 【伪】第一次在Xcode中安装CocoaPods并,安装第三方框架AFNetWorking!
- 安装多版本的xcode中,cocoapods安装出现的问题
- Xcode插件管理工具CocoaPods安装教程
- Xcode CocoaPods安装和使用教程(更新)
- 安装多个xcode后用cocoapods引用三方报错
- Xcode安装使用第三方库的管理工具CocoaPods
- Xcode安装使用第三方库的管理工具CocoaPods
- 安装cocoaPods出现错误error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not
- CocoaPods for Xcode
- xcode 配置 CocoaPods方法
- xcode因为cocoapods打不开
- xcode 集成cocoapods插件
- cocoapods-xcode插件 下载
- Xcode的插件cocoapods
- homerHEVC代码阅读(3)——基础结构之HVENC_Cfg
- spring-mvc.xml
- wireshark 开源网络数据包分析软件
- iOS开发 delegate实现页面间的交互
- 欢迎使用CSDN-markdown编辑器
- Xcode中安装CocoaPods
- 华为oj 公共字串计算
- Zend Studio添加行注释和设置模板
- HTML基础知识
- IOS工作小结
- hpuoj 1715: 感恩节KK专场——2015年的第一场雪 【分类转化思想】【校赛】
- Html设置网页背景图片
- LeetCode(1)--Two Sum
- 一起talk C栗子吧(第六十八回:C语言实例--DIY字符串长度函数的小疑问)