1. 程式人生 > >cocopods遇到The dependency `XXXXXX` is not used in any concrete target的報錯處理

cocopods遇到The dependency `XXXXXX` is not used in any concrete target的報錯處理

The dependency `` is not used in any concrete target

The dependency `AFNetworking ` is not used in any concrete target

CocoaPods再遇困難,前幾天電腦重灌了系統,所有的開發工具就都裝了最新的,當我用CocoaPods的時候,出了一個提示,大概就是我的版本不是 last version,然後給你提示了一個命令,直接複製即可,就是下面這個:

sudo gem install cocoapods --pre  //這裡也可以先不用,先改一下podfile裡面的格式,如下所示,不行再執行這裡

安裝cocoapods的預覽版本,就會更新下來新的1.0.0.beta.2版本,如下所示:

Successfully installed cocoapods-1.0.0.beta.2

Parsing documentation for cocoapods-1.0.0.beta.2

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

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.

我用的三方庫比較多,挺長的,出這個錯是告訴我們我們所用的庫沒有指定target,它不知道用在哪裡,所以就給報錯了,然後我去了cocoapods的官網看了下,cocoapods官網地址https://cocoapods.org/

官網是這樣給推薦的:

在建立Podfile的時候,用這種格式使用

platform :ios, '8.0'

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

target 'MyApp' do

pod 'AFNetworking', '~> 2.6'

pod 'ORStackView', '~> 3.0'

pod 'SwiftyJSON', '~> 2.3'

end

然後終端  $ pod install  執行就可以了

裡面的 MyApp 記得替換為自己攻城裡面的target。這樣就基本OK了,執行pod install / pod update 就都可以了。(use_frameworks! 這個是個別需要的,這裡修改一下,可以把我上面的程式碼中的這一行【刪除】)

下面是另外一種寫法

platform :ios, '8.0'

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

def pods

pod 'AFNetworking', '~> 2.6'

pod 'ORStackView', '~> 3.0'

pod 'SwiftyJSON', '~> 2.3'

end

target 'MyApp' do

pods

end