CocoaPods升級后(最新版本1.0.0),安裝第三方庫的時候會報如下錯誤:
The dependency `SDWebImage (~> 3.7.6)` is not used in any concrete target.
The dependency `SVProgressHUD (~> 2.0.3)` is not used in any concrete target.
The dependency `AFNetworking (~> 3.1.0)` is not used in any concrete target.
原因:CocoaPods升級后,Podfile文件的內容格式要求發生了變化,必須指出指出所用第三方庫的target。
解決步驟:
(1)檢查CocoaPods的版本
pod --version
(2) 升級或安裝最新版本(目前版本1.0.0)
注意:如果cocoapods已經是1.0.0版本,則跳過該步驟直接進入第三個步驟。
升級命令:sudo gem update -n /usr/local/bin --system
安裝命令:sudo gem install -n /usr/local/bin cocoapods
(3)修改Podfile的內容
修改前的Podfile文件的內容:
platform:ios,'7.0' pod 'MJRefresh', '~> 3.1.0' pod 'SDWebImage', '~> 3.7.6' pod 'SVProgressHUD', '~> 2.0.3' pod 'AFNetworking', '~> 3.1.0'
修改后的Podfile文件的內容:
platform:ios,'7.0' target "MyTarget" do pod 'MJRefresh', '~> 3.1.0' pod 'SDWebImage', '~> 3.7.6' pod 'SVProgressHUD', '~> 2.0.3' pod 'AFNetworking', '~> 3.1.0' end
在Podfile文件中需要明確指出使用第三方庫的target。
通過以上三個步驟 問題完美解決 ^_^