CocoaPods報(bào)錯(cuò):The dependency `AFNetworking ` is not used in any concrete target或者Permission denied @ rb_sysopen - /Users/John_LS/.gemrc

如何在Mac OS X上安裝 Ruby運(yùn)行環(huán)境

CocoaPods 的安裝和使用

ex:

The dependency `` is not used in any concrete target

The dependency AFNetworking is not used in any concrete target

CocoaPods再遇困難,前幾天電腦重裝了系統(tǒng),所有的開發(fā)工具就都裝了最新的,當(dāng)我用CocoaPods的時(shí)候,出了一個(gè)提示,大概就是我的版本不是 last version,然后給你提示了一個(gè)命令,直接復(fù)制即可,就是下面這個(gè):

sudo gem install cocoapods --pre

安裝cocoapods的預(yù)覽版本,就會(huì)更新下來新的1.0.0.beta.2版本,如下所示:

Successfully installed cocoapods-1.0.0.beta.2

Parsing documentation for cocoapods-1.0.0.beta.2

很高興啊,更新了新的版本,然而pod install就出錯(cuò)了,悲了個(gè)劇!出錯(cuò)如下:

Updating local specs repositories

Analyzing dependencies

[!] The dependency FMDB (~> 2.3) is not used in any concrete target.

The dependency SDWebImage (~> 3.6) is not used in any concrete target.

The dependency AFNetworking (~> 2.3.0) is not used in any concrete target.

The dependency DACircularProgress (~> 2.2.0) is not used in any concrete target.

The dependency MBProgressHUD (~> 0.8) is not used in any concrete target.

The dependency PSTCollectionView (~> 1.2.1) is not used in any concrete target.

The dependency HPGrowingTextView (~> 1.1) is not used in any concrete target.

The dependency ProtocolBuffers (= 1.9.3) is not used in any concrete target.

The dependency leveldb-library (~> 1.18.1) is not used in any concrete target.

The dependency SCLAlertView-Objective-C (~> 0.7.5) is not used in any concrete target.

The dependency MWPhotoBrowser (~> 1.4.1) is not used in any concrete target.

The dependency MMMarkdown (~> 0.5) is not used in any concrete target.

The dependency MJExtension (~> 2.5.16) is not used in any concrete target.

The dependency MJRefresh (~> 2.4.12) is not used in any concrete target.

The dependency Masonry (~> 0.6.3) is not used in any concrete target.

我用的三方庫(kù)比較多,挺長(zhǎng)的,出這個(gè)錯(cuò)是告訴我們我們所用的庫(kù)沒有指定target,它不知道用在哪里,所以就給報(bào)錯(cuò)了,然后我去了cocoapods的官網(wǎng)看了下,cocoapods官網(wǎng)地址

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

在創(chuàng)建Podfile的時(shí)候,用這種格式使用,

platform :ios, '8.0'

use_frameworks!

target 'MyApp' do

pod 'AFNetworking', '~> 2.6'

pod 'ORStackView', '~> 3.0'

pod 'SwiftyJSON', '~> 2.3'

end

里面的 MyApp 記得替換為自己攻城里面的target。這樣就基本OK了,執(zhí)行pod install / pod update 就都可以了。

如果提示Permission denied @ rb_sysopen - /Users/John_LS/.gemrc這個(gè)錯(cuò)誤,那說明沒有權(quán)限。

原因:我已經(jīng)更新了我的rubygem像這樣的gem update --syste,但是,只有我當(dāng)?shù)氐膅ems被更新。由于gem: --user-install安裝限制在我的/etc/.gemrc。當(dāng)工作時(shí),它使用全局rubygem與我無關(guān)。

解決方法:要解決這個(gè)問題,我更新了全局的RubyGems:sudo gem update --system --no-user-install.。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

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