日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

cocoa pods的安装与我遇到的问题

發布時間:2023/12/20 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cocoa pods的安装与我遇到的问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.打開終端

終端輸入 ?ruby -v? 查看ruby的版本

打印代碼:

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

?

?

2. 更換ruby鏡像

終端輸入如下命令(把Ruby鏡像指向taobao,避免被墻,你懂得)

a.移除現有?Ruby?默認源輸入以下指令

gem sources --remove https://rubygems.org/?

b.使用新的源輸入以下指令?

gem sources -a https://ruby.taobao.org/?

c.驗證新源是否替換成功輸入以下指令?

gem sources -l ?(用來檢查使用替換鏡像位置成功)

打印代碼:

bogon:~ LiuWenqiang$ gem sources --remove https://rubygems.org/ source https://rubygems.org/ not present in cache bogon:~ LiuWenqiang$ gem sources -a https://ruby.taobao.org/ source https://ruby.taobao.org/ already present in the cache bogon:~ LiuWenqiang$ gem sources -l *** CURRENT SOURCES ***

?

?

3.安裝cocoapods

終端 ??sudo gem install cocoa pods

這就遇到我的第一個問題:

如果你的ruby 版本過低 就會報錯:

ERROR: Error installing cocoa:activesupport requires Ruby version >= 2.2.2. ERROR: Error installing pods:activesupport requires Ruby version >= 2.2.2.

前幾天,我就搞到這個地方,嘗試了好幾種方法更新ruby 但是都沒有成功,今天偶然看到一個文章,(有種淡淡的憂傷:http://www.jianshu.com/p/ad98a3364803

)并得到作者的幫助,才得以解決

解決方案:

(1)安裝 RVM baby 版本管理器?

\curl -sSL https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash

打印代碼:

In case of problems: https://rvm.io/help and https://twitter.com/rvm_io

說明安裝成功

(2)

source ~/.bashrc??

source ~/.bash_profile??

rvm -v ?

打印代碼:

rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

(3)用RVM升級Ruby查看當前ruby版本

ruby -v?

rvm list known

打印代碼:

# MRI Rubies [ruby-]1.8.6[-p420] [ruby-]1.8.7[-head] # security released on head [ruby-]1.9.1[-p431] [ruby-]1.9.2[-p330] [ruby-]1.9.3[-p551] [ruby-]2.0.0[-p648] [ruby-]2.1[.8] [ruby-]2.2[.4] [ruby-]2.3[.0] [ruby-]2.2-head ruby-head# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2 # JRuby jruby-1.6[.8] jruby-1.7[.23] jruby[-9.0.5.0] jruby-head# Rubinius rbx-1[.4.3] rbx-2.3[.0] rbx-2.4[.1] rbx[-2.5.8] rbx-head

(4)安裝ruby 2.2.2 版本

rvm install 2.2.2

如果打印:

…… ruby-2.2.2 - #validate archiveruby-2.2.2 - #extractruby-2.2.2 - #validate binaryruby-2.2.2 - #setupruby-2.2.2 - #gemset created /Users/abc/.rvm/gems/ruby-2.2.2@globalruby-2.2.2 - #importing gemset
/Users/abc/.rvm/gemsets/global.gems..............................ruby-2.2.2 - #generating global wrappers........ruby-2.2.2 - #gemset created /Users/abc/.rvm/gems/ruby-2.2.2ruby-2.2.2 - #importing gemsetfile /Users/abc/.rvm/gemsets/default.gems
  evaluated to empty gem list ruby
-2.2.2 - #generating default wrappers........Updating certificates in '/etc/openssl/cert.pem'.mkdir: /etc/openssl: Permission deniedmkdir -p "/etc/openssl" failed, retrying with sudoLiuWenqiang password required for 'mkdir -p /etc/openssl': and sudo mkdir worked

?則說明安裝成功了

打印代碼:

Done with Command Line Tools (OS X 10.11) for Xcode Done. ==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress ==> Installing the Command Line Tools (expect a GUI popup): ==> /usr/bin/sudo /usr/bin/xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates Failed during: /usr/bin/sudo /usr/bin/xcode-select --install Requirements installation failed with status: 1.

如果安裝失敗?

?

(5)查看當前ruby 版本

ruby -v

ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]

現在ruby版本已經是2.2.2了

第一個問題就解決了

?

?

4. ?繼續安裝 CocoaPods

sudo gem install cocoa pods

sudo gem install -n /usr/local/bin cocoapods

pod setup

?

5. ?更新 gem

sudo gem update --system

?

6.??新建一個項目,名字PodTest

?

7. ???$ cd? 項目路徑 (中間有空格,)

cd?/Users/lucky/Desktop/PodTest???

?

8. ??建立Podfile(配置文件)

? ??vim Podfile

鍵盤輸入 i 進入編輯模式,輸入

platform :ios, '7.0'?

pod 'MBProgressHUD', '~> 0.8’?(之前的,我的電腦上已經無效了,報錯: [!] The dependency `MBProgressHUD (~> 0.8)` is not used in any concrete target.)

(現在使用:MyApp 替換成自己的項目名)

target 'MyApp' do

pod 'AFNetworking', '~> 2.6'

pod 'ORStackView', '~> 3.0'

end

?

?

?

?

然后按Esc,并且輸入“ :”號進入vim命令模式,然后在冒號后邊輸入wq

?

再輸入 ?pod install

?

注意:現在打開項目不是點擊 PodTest.xodeproj了,而是點擊?PodTest.xcworkspace

?

為了確定AFNetworking是否支持CocoaPods,可以用CocoaPods的搜索功能驗證一下。在終端中輸入:

pod search AFNetworking

總結

以上是生活随笔為你收集整理的cocoa pods的安装与我遇到的问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。