cocospods 最新安装教程
Terminator 终端
原来 安装 cocoa pods 终端命令 :sudo gem install cocoapods #已经无效
系统更新后的 cocoa pods 终端命令 : sudo gem install -n /usr/local/bin cocoapods #现在用这个
大家同在天朝做开发,在 termintor 中输入cocoapods的安装命令没有反应,这就对了说明你也被墙了。
那么好 我们 做这一步操作来解决这个问题:
更换Ruby镜像--淘宝的那个镜像(https://ruby.taobao.org/ )已经不可用了。官方的需要FQ。所以我们现在用最新支持的ruby镜像(https://gems.ruby-china.org/)
需要的命令行:
gem sources --remove https://rubygems.org/
gem sources -a https://gems.ruby-china.org/
gem sources -l (用来检查使用替换镜像位置成功)
出现则说明成功了。
1.验证你的Ruby 镜像源 命令:$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.org
2.如果是 china.org 的镜像源,你就可以直接用 命令 : sudo gem install -n /usr/local/bin cocoapods 安装。
3.如果不是淘宝的镜像源:如下操作
$ gem sources --remove https://rubygems.org/
//等有反应之后再敲入以下命令
$ gem source -a https://gems.ruby-china.org
之后在检查一下镜像源是否安装成功。
4. install cocoa pods 完出现如下信息
localhost:~ keku$ sudo gem install -n /usr/local/bin cocoapods
Successfully installed cocoapods-1.0.1
Parsing documentation for cocoapods-1.0.1
1 gem installed
localhost:~ keku$
说明安装完成
之后输入命令 :pod setup
出现如下信息 成功。
localhost:~ keku$ pod setup
Setting up CocoaPods master repo
$ /usr/bin/git pull --ff-only
From https://github.com/CocoaPods/Specs
0cacc4d..47c07ed master -> origin/master
Updating 0cacc4d..47c07ed
Fast-forward
.../1.0.0/AppForSaleFramework.podspec.json | 3 +-
.../1.0.10/AppForSaleFramework.podspec.json | 3 +-
.../1.0.11/AppForSaleFramework.podspec.json | 3 +-
.../1.0.13/AppForSaleFramework.podspec.json | 3 +-
.../1.0.16/AppForSaleFramework.podspec.json | 3 +-
.../1.0.17/AppForSaleFramework.podspec.json | 3 +-
.../1.0.18/AppForSaleFramework.podspec.json | 3 +-
.../1.0.19/AppForSaleFramework.podspec.json | 3 +-
.../1.0.20/AppForSaleFramework.podspec.json | 3 +-
.../1.0.21/AppForSaleFramework.podspec.json | 3 +-
.../1.0.22/AppForSaleFramework.podspec.json | 3 +-
.../1.0.23/AppForSaleFramework.podspec.json | 3 +-
.../1.0.25/AppForSaleFramework.podspec.json | 3 +-
.../1.0.26/AppForSaleFramework.podspec.json | 3 +-
.../1.0.27/AppForSaleFramework.podspec.json | 3 +-
.../1.0.28/AppForSaleFramework.podspec.json | 3 +-
.../1.0.29/AppForSaleFramework.podspec.json | 3 +-
.../1.0.30/AppForSaleFramework.podspec.json | 3 +-
.../1.0.31/AppForSaleFramework.podspec.json | 3 +-
.../1.0.37/AppForSaleFramework.podspec.json | 3 +-
.../1.0.38/AppForSaleFramework.podspec.json | 3 +-
.../1.0.39/AppForSaleFramework.podspec.json | 3 +-
.../4.0.0/AppForSaleFramework.podspec.json | 3 +-
.../4.0.11/AppForSaleFramework.podspec.json | 3 +-
.../4.0.12/AppForSaleFramework.podspec.json | 3 +-
.../4.0.13/AppForSaleFramework.podspec.json | 3 +-
.../4.0.14/AppForSaleFramework.podspec.json | 3 +-
.../4.0.15/AppForSaleFramework.podspec.json | 3 +-
.../4.0.16/AppForSaleFramework.podspec.json | 3 +-
.../4.0.17/AppForSaleFramework.podspec.json | 3 +-
.../4.0.18/AppForSaleFramework.podspec.json | 3 +-
.../4.0.19/AppForSaleFramework.podspec.json | 3 +-
.../4.0.23/AppForSaleFramework.podspec.json | 3 +-
.../4.0.24/AppForSaleFramework.podspec.json | 3 +-
.../4.0.25/AppForSaleFramework.podspec.json | 3 +-
.../4.0.26/AppForSaleFramework.podspec.json | 3 +-
.../4.0.27/AppForSaleFramework.podspec.json | 3 +-
.../4.0.46/AppForSaleFramework.podspec.json | 3 +-
.../4.0.47/AppForSaleFramework.podspec.json | 3 +-
.../4.0.57/AppForSaleFramework.podspec.json | 3 +-
.../4.0.58/AppForSaleFramework.podspec.json | 3 +-
.../4.0.59/AppForSaleFramework.podspec.json | 3 +-
.../4.0.60/AppForSaleFramework.podspec.json | 3 +-
.../4.0.61/AppForSaleFramework.podspec.json | 3 +-
.../1.1/BSForegroundNotification.podspec.json | 24 +++++++++++
.../1.3.1/BSSelectableView.podspec.json | 22 +++++++++++
.../0.6.0/DummyTestingPod.podspec.json | 46 ++++++++++++++++++++++
.../1.0.7/ECHttpRequestManager.podspec.json | 30 ++++++++++++++
.../Hyphenate_CN/3.1.5.1/Hyphenate_CN.podspec.json | 42 ++++++++++++++++++++
Specs/OMExtension/0.0.1/OMExtension.podspec.json | 24 -----------
Specs/OMExtension/0.0.2/OMExtension.podspec.json | 24 -----------
Specs/OMExtension/0.0.3/OMExtension.podspec.json | 24 -----------
Specs/OMExtension/0.0.5/OMExtension.podspec.json | 24 -----------
.../{0.0.4 => 1.0}/OMExtension.podspec.json | 4 +-
Specs/OMKit/0.0.6/OMKit.podspec.json | 25 ------------
Specs/OMKit/0.0.7/OMKit.podspec.json | 25 ------------
Specs/OMKit/0.0.8/OMKit.podspec.json | 25 ------------
Specs/Spots/3.0.3/Spots.podspec.json | 44 +++++++++++++++++++++
.../0.1.8/SunbeamTimerService.podspec.json | 30 ++++++++++++++
.../1.5.2/TWNetworkManager.podspec.json | 30 ++++++++++++++
60 files changed, 358 insertions(+), 217 deletions(-)
create mode 100644 Specs/BSForegroundNotification/1.1/BSForegroundNotification.podspec.json
create mode 100644 Specs/BSSelectableView/1.3.1/BSSelectableView.podspec.json
create mode 100644 Specs/DummyTestingPod/0.6.0/DummyTestingPod.podspec.json
create mode 100644 Specs/ECHttpRequestManager/1.0.7/ECHttpRequestManager.podspec.json
create mode 100644 Specs/Hyphenate_CN/3.1.5.1/Hyphenate_CN.podspec.json
delete mode 100644 Specs/OMExtension/0.0.1/OMExtension.podspec.json
delete mode 100644 Specs/OMExtension/0.0.2/OMExtension.podspec.json
delete mode 100644 Specs/OMExtension/0.0.3/OMExtension.podspec.json
delete mode 100644 Specs/OMExtension/0.0.5/OMExtension.podspec.json
rename Specs/OMExtension/{0.0.4 => 1.0}/OMExtension.podspec.json (93%)
delete mode 100644 Specs/OMKit/0.0.6/OMKit.podspec.json
delete mode 100644 Specs/OMKit/0.0.7/OMKit.podspec.json
delete mode 100644 Specs/OMKit/0.0.8/OMKit.podspec.json
create mode 100644 Specs/Spots/3.0.3/Spots.podspec.json
create mode 100644 Specs/SunbeamTimerService/0.1.8/SunbeamTimerService.podspec.json
create mode 100644 Specs/TWNetworkManager/1.5.2/TWNetworkManager.podspec.json
CocoaPods 1.1.0.rc.2 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.1.0.rc.2
Setup completed
localhost:~ keku$
5.查询
localhost:~ keku$ pod search fmdb
就可以查询到了。
6.配置 Podfile
首先定位到项目文件目录
cd 项目位置
然后添加podfile文件:vim podfile (注:在写该文件的时候要注意格式 ' ' );
进入后按i进入插入模式,进行编辑,安装官方最新的文档格式:
platform :ios, '8.0'
target '你的项目名称' do
pod 'AFNetworking', '~> 3.0'
end
编辑完成后,按ESC退出编辑模式,最后输入:wq保存并退出文件,此时可以发现在项目目录下多了一个Podfile的文件,请注意这个文件必须与.xcodeproj在同一目录下,
最后:pod install进行安装即可
CocoaPods库的跳过更新安装
pod install --verbose --no-repo-update(跳过更新进行安装)
pod update --verbose --no-repo-update(跳过更新进行更新)
问题1.
localhost:~ keku$ pod search fmdb
[!] Unable to find a pod with name, author, summary, or descriptionmatching `fmdb`
localhost:~ keku$ rm ~/Library/Caches/CocoaPods/search_index.json
localhost:~ keku$ pod search fmdb
解决方法: rm ~/Library/Caches/CocoaPods/search_index.json
platform :ios,'8.0'
target 'DOUYUAPP' do
pod 'HMSegmentedControl'
pod 'AFNetworking'
pod 'SDWebImage'
pod 'MJRefresh'
pod 'MJExtension'
end