cocoaPods更新問題解決

轉(zhuǎn)自:http://blog.csdn.net/xingxingrainlove/article/details/53257944

今天在運(yùn)行項目時突然遇到異常報錯:not find -lpod;一開始感覺很莫名其妙归形,隨后意識到可能是cocoaPods的問題悲没,于是嘗試更新pod install蝌箍,結(jié)果紅色警告提示:

The `master` repo requires CocoaPods 1.0.0 - (currently using 0.39.0)碰酝;所以最終問題是cocoaPods版本太低,需要更新了(我的當(dāng)前版本是0.39.0)色洞。

《自以為是的更新步驟:

1.更新gem

$ sudo gem update

結(jié)果如下:

Updating installed gems

Updating CFPropertyList

Fetching: CFPropertyList-2.3.3.gem (100%)

Successfully installed CFPropertyList-2.3.3

Parsing documentation for CFPropertyList-2.3.3

Installing ri documentation for CFPropertyList-2.3.3

Installing darkfish documentation for CFPropertyList-2.3.3

Parsing documentation for CFPropertyList-2.3.3

Updating activesupport

Fetching: concurrent-ruby-1.0.2.gem (100%)

Successfully installed concurrent-ruby-1.0.2

Fetching: activesupport-5.0.0.1.gem (100%)

ERROR:? Error installing activesupport:

activesupport requires Ruby version >= 2.2.2.//Ruby version的版本較低贞言, 最低需要2.2.2版本

Updating bigdecimal

Fetching: bigdecimal-1.2.7.gem (100%)

Building native extensions.? This could take a while...

Successfully installed bigdecimal-1.2.7

Parsing documentation for bigdecimal-1.2.7

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/bigdecimal-1.2.7/bigdecimal.bundle, skipping

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for bigdecimal.bundle, skipping

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for bigdecimal.o, skipping

Installing ri documentation for bigdecimal-1.2.7

Installing darkfish documentation for bigdecimal-1.2.7

Parsing documentation for bigdecimal-1.2.7

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/bigdecimal-1.2.7/bigdecimal.bundle, skipping

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for bigdecimal.bundle, skipping

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for bigdecimal.o, skipping

Updating claide

Fetching: claide-1.0.1.gem (100%)

Successfully installed claide-1.0.1

Installing darkfish documentation for CFPropertyList-2.3.3

Parsing documentation for CFPropertyList-2.3.3

Updating activesupport

Fetching: concurrent-ruby-1.0.2.gem (100%)

Successfully installed concurrent-ruby-1.0.2

Fetching: activesupport-5.0.0.1.gem (100%)

ERROR:? Error installing activesupport:

activesupport requires Ruby version >= 2.2.2.//Ruby version的版本較低, 最低需要2.2.2版本

Updating bigdecimal

Fetching: bigdecimal-1.2.7.gem (100%)

Building native extensions.? This could take a while...

Successfully installed bigdecimal-1.2.7

Parsing documentation for bigdecimal-1.2.7

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/bigdecimal-1.2.7/bigdecimal.bundle, skipping

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for bigdecimal.bundle, skipping

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for bigdecimal.o, skipping

Installing ri documentation for bigdecimal-1.2.7

Installing darkfish documentation for bigdecimal-1.2.7

Parsing documentation for bigdecimal-1.2.7

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/bigdecimal-1.2.7/bigdecimal.bundle, skipping

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for bigdecimal.bundle, skipping

unable to convert "\xCA" from ASCII-8BIT to UTF-8 for bigdecimal.o, skipping

Updating claide

Fetching: claide-1.0.1.gem (100%)

……………...

ERROR:? While executing gem ... (Errno::EPERM)

Operation not permitted - /usr/bin/xcodeproj//意思是gem更新失敗了糕篇,出現(xiàn)了錯誤啄育,究其原因就是Ruby version的版本較低導(dǎo)致。

注:這種情況是不正常的拌消,說明更新失敗挑豌,其它可以忽略:失敗原因就在畫線的兩行ERROR里面。

2.我自動忽略了以上報錯繼續(xù)進(jìn)行下面的操作:

gem sources -l

sudo gem install cocoapods

很顯然注定是要失敗的,一直報錯:

ERROR:? While executing gem ... (Errno::EPERM)

Operation not permitted - /usr/bin/xcodeproj

最后一步pod setup

繼續(xù)報錯:[!] The `master` repo requires CocoaPods 1.0.0 -? (currently using 0.39.0)

所以什么用也沒有Cビⅰ:蠲恪!B敛壳鹤!

《正確的解決步驟

從網(wǎng)上搜索解決方案,經(jīng)過實(shí)踐總結(jié)正確的步驟饰迹。(幫助文章鏈接:http://blog.csdn.net/yangyangzhang1990/article/details/52252146

很明顯從上面的問題中找到了最根本的原因是Ruby的版本較低芳誓。

第一步:首先檢測各種版本是否合格:

rvm-v ?:ram相當(dāng)于一個ruby倉庫,管理ruby不同版本啊鸭。(我的當(dāng)前版本是1.26.11锹淌,可以,當(dāng)然最好更新到1.27.0)

如果低于1.26.11需要安裝一下:source ~/.rvm/scripts/rvm

安裝成功提示是:rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

版本為:1.27.0

第二步:將Ruby的版本升級到2.2.2赠制,(建議不要安裝 最新版的 2.3.0)

rvm install ruby 2.2.2

安裝成功提示是:ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]

我的提示是:Warning, new version of rvm available '1.27.0', you are using older version '1.26.11'.j警告版本低于最新版赂摆,暫時不影響。

ruby -v:看一下當(dāng)前版本

安裝成功提示是:ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin15]

如果還沒有安裝成功钟些,提示你 home-brew 沒有安裝烟号,那你需要安裝home-brew

第三步:安裝home-brew

/usr/bin/ruby -e "$(curl -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"

詳細(xì)安裝 步驟 可查看博客地址:http://blog.csdn.net/yangyangzhang1990/article/details/51578565

第四步:安裝cocoaPods

安裝home-brew 成功后,執(zhí)行? brew install ruby 2.2.2?? 政恍。

首先? ruby -v??? 查看你的ruby 版本

接著? rvm -v???? 查看你的rvm? 版本

接著gem-v查看你的gem版本

接著? brew -v?? 查看你的brew 版本

gem source-l查看你的鏡像源汪拥。這里推薦使用 騰訊云 鏡像。

gem sources --remove老得鏡像源地址

gem sources -a新的鏡像源地址

gem sources -l查看當(dāng)前最新的鏡像源地址

具體操作提示:

czhdeiMac:kuihuajingyingwang czh$gem sources -l

*** CURRENT SOURCES ***

https://ruby.taobao.org

https://ruby.taobao.org/

czhdeiMac:kuihuajingyingwang czh$gem sources --removehttps://ruby.taobao.org

https://ruby.taobao.orgremoved from sources

czhdeiMac:kuihuajingyingwang czh$gem sources -ahttp://gems.ruby-china.org/

http://gems.ruby-china.org/added to sources

czhdeiMac:kuihuajingyingwang czh$sudo gem? install -n /usr/local/bin?cocoa pods ? ? //這個地方不能用之前舊的更新方法:sudo gem install cocoapods

Password:

Fetching: i18n-0.7.0.gem (100%)

Successfully installed i18n-0.7.0

如果這樣執(zhí)行 pod install的時候還出現(xiàn)

The dependency ``isnotusedinany concrete target

The dependency `AFNetworking`isnotusedinany concrete target

官網(wǎng)是這樣給推薦的:

在創(chuàng)建Podfile的時候篙耗,用這種格式使用迫筑,

platform:ios,'8.0'

#use_frameworks!個別需要用到它,比如reactiveCocoa

target?'MyApp' do

pod'AFNetworking','~> 2.6'

pod'ORStackView','~> 3.0'

pod'SwiftyJSON','~> 2.3'

end

里面的MyApp記得替換為自己攻城里面的target宗弯。這樣就基本OK了脯燃,執(zhí)行pod install / pod update 就都可以了。(use_frameworks! 這個是個別需要的蒙保,這里修改一下辕棚,可以把我上面的代碼中的這一行【刪除】

Successfully installed claide-1.0.1

[!] Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile

正確的寫法Swift:

platform :ios, ‘8.0’

target ‘TestObjectTwo’do

pod ‘Alamofire’, ‘~>4.0’

pod ‘SnapKit’, ‘~>3.0.2’

use_frameworks!

end

在安裝CocoaPods出現(xiàn)了以下問題:

ERROR: SSL verification error at depth 1: unable to get local issuer certificate (20)

ERROR: You must add /C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Certification Authority to your local trusted store

ERROR: SSL verification error at depth 2: self signed certificate in certificate chain (19)

ERROR: Root certificate is not trusted (/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA)

出現(xiàn)這個問題的原因主要是Ruby環(huán)境需要2.2版本以上,所以要更新Ruby環(huán)境邓厕。

更新Ruby環(huán)境

0.首先要安裝 Homebrew 終端輸入這條命令即可 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

1.安裝rvm $ curl -L get.rvm.io | bash -s stable

2.裝載rvm $ source ~/.rvm/scripts/rvm

3.安裝2.3.0版本ruby $ rvm install 2.3.0

4.將2.3.0設(shè)為默認(rèn) $ rvm use 2.3.0 --default

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末逝嚎,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子邑狸,更是在濱河造成了極大的恐慌懈糯,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,755評論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件单雾,死亡現(xiàn)場離奇詭異赚哗,居然都是意外死亡她紫,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,305評論 3 395
  • 文/潘曉璐 我一進(jìn)店門屿储,熙熙樓的掌柜王于貴愁眉苦臉地迎上來贿讹,“玉大人,你說我怎么就攤上這事够掠∶窆樱” “怎么了?”我有些...
    開封第一講書人閱讀 165,138評論 0 355
  • 文/不壞的土叔 我叫張陵疯潭,是天一觀的道長赊堪。 經(jīng)常有香客問我,道長竖哩,這世上最難降的妖魔是什么哭廉? 我笑而不...
    開封第一講書人閱讀 58,791評論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮相叁,結(jié)果婚禮上遵绰,老公的妹妹穿的比我還像新娘。我一直安慰自己增淹,他們只是感情好椿访,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,794評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著虑润,像睡著了一般成玫。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上端辱,一...
    開封第一講書人閱讀 51,631評論 1 305
  • 那天梁剔,我揣著相機(jī)與錄音,去河邊找鬼舞蔽。 笑死,一個胖子當(dāng)著我的面吹牛码撰,可吹牛的內(nèi)容都是我干的渗柿。 我是一名探鬼主播,決...
    沈念sama閱讀 40,362評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼脖岛,長吁一口氣:“原來是場噩夢啊……” “哼朵栖!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起柴梆,我...
    開封第一講書人閱讀 39,264評論 0 276
  • 序言:老撾萬榮一對情侶失蹤陨溅,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后绍在,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體门扇,經(jīng)...
    沈念sama閱讀 45,724評論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡雹有,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,900評論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了臼寄。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片霸奕。...
    茶點(diǎn)故事閱讀 40,040評論 1 350
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖吉拳,靈堂內(nèi)的尸體忽然破棺而出质帅,到底是詐尸還是另有隱情,我是刑警寧澤留攒,帶...
    沈念sama閱讀 35,742評論 5 346
  • 正文 年R本政府宣布煤惩,位于F島的核電站,受9級特大地震影響炼邀,放射性物質(zhì)發(fā)生泄漏盟庞。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,364評論 3 330
  • 文/蒙蒙 一汤善、第九天 我趴在偏房一處隱蔽的房頂上張望什猖。 院中可真熱鬧,春花似錦红淡、人聲如沸不狮。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,944評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽摇零。三九已至,卻和暖如春桶蝎,著一層夾襖步出監(jiān)牢的瞬間驻仅,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,060評論 1 270
  • 我被黑心中介騙來泰國打工登渣, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留噪服,地道東北人。 一個月前我還...
    沈念sama閱讀 48,247評論 3 371
  • 正文 我出身青樓胜茧,卻偏偏與公主長得像粘优,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子呻顽,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,979評論 2 355

推薦閱讀更多精彩內(nèi)容