最近在用cocoapods導入第三方庫的時候出現如下錯誤,現在將錯誤處理放發一步步貼出來:
1、當導入一些第三方庫的時候如:
pod 'Masonry', '~> 1.0.2'
pod 'MBProgressHUD', '~> 1.0.0'
pod 'YYAsyncLayer', '~> 1.0.0'
pod 'THLabel', '~> 1.4.8'
pod 'AFNetworking', '~> 3.1.0'
pod 'TMCache', '~> 2.1.0'
pod 'JSONModel', '~> 1.5.1'
pod 'SSZipArchive', '~> 1.5.0'
1、
當你執行pod install時出現了下面的報錯:
[!] The `master` repo requires CocoaPods 1.0.0 -? (currently using 0.39.0)
這就是說我們的cocopods版本太舊,是currently using 0.39.0這個,這個master需要CocoaPods 1.0.0 的版本
2、
那執行 sudo?gem?update?cocoapods?? 更新cocopods 就又提示了下面這個錯誤:
Updating cocoapods
ERROR:? While executing gem ... (Errno::EPERM)
3、接下來執行sudo gem install -n /usr/local/bin cocoapods --pre
就可以成功的更新了cocopods的版本,采用pod —version 查看cocopods的版本號1.0.0~1.2.0
4、接下來執行pod install 的時候,又會出現如下錯誤
pod install
Re-creating CocoaPods due to major version update.
Analyzing dependencies
[!] The dependency `AFNetworking (~> 3.1.0)` is not used in any concrete target.
The dependency `SDWebImage (~> 3.7.6)` is not used in any concrete target.
The dependency `UITableView+FDTemplateLayoutCell (~> 1.5.beta)` is not used in any concrete target.
The dependency `MJRefresh (~> 3.1.0)` is not used in any concrete target.
The dependency `SVProgressHUD (~> 2.0.3)` is not used in any concrete target.
The dependency `FMDB (~> 2.6.2)` is not used in any concrete target.
The dependency `MJExtension (~> 3.0.10)` is not used in any concrete target.
The dependency `RealReachability` is not used in any concrete target.
The dependency `CocoaLumberjack` is not used in any concrete target.
The dependency `GPUImage (~> 0.1.7)` is not used in any concrete target.
The dependency `TTTAttributedLabel` is not used in any concrete target.
The dependency `Masonry (~> 1.0.2)` is not used in any concrete target.
The dependency `MBProgressHUD (~> 1.0.0)` is not used in any concrete target.
The dependency `YYAsyncLayer (~> 1.0.0)` is not used in any concrete target.
The dependency `THLabel (~> 1.4.8)` is not used in any concrete target.
The dependency `TMCache (~> 2.1.0)` is not used in any concrete target.
The dependency `JSONModel (~> 1.5.1)` is not used in any concrete target.
The dependency `SSZipArchive (~> 1.5.0)` is not used in any concrete target.
The dependency `FLEX (~> 2.0)` is not used in any concrete target.
這個問題產生的可以通過 $ pod --version 查看版本號;
原因是podfile升級到最新版本,pod里的內容必須明確指出所用第三方庫的target;可以修改Podfile文件的配置文件,讓它兼容不指定固定版本;且又不報錯;
platform:ios, '8.0'
inhibit_all_warnings!
target ‘XXXProjectName’ do
pod 'AFNetworking', '~> 3.1.0'
pod 'SDWebImage', '~> 3.7.6'
pod 'UITableView+FDTemplateLayoutCell', '~> 1.5.beta'
pod 'MJRefresh', '~> 3.1.0'
pod 'SVProgressHUD', '~> 2.0.3'
pod 'FMDB', '~> 2.6.2'
pod 'MJExtension', '~> 3.0.10'
pod 'RealReachability'
pod 'CocoaLumberjack'
pod 'GPUImage', '~> 0.1.7'
pod 'TTTAttributedLabel'
pod 'Masonry', '~> 1.0.2'
pod 'MBProgressHUD', '~> 1.0.0'
pod 'YYAsyncLayer', '~> 1.0.0'
pod 'THLabel', '~> 1.4.8'
pod 'TMCache', '~> 2.1.0'
pod 'JSONModel', '~> 1.5.1'
pod 'SSZipArchive', '~> 1.5.0'
pod 'FLEX', '~> 2.0', :configurations => ['Debug']
end
其中XXXProjectName要換成當前target名,最后不要忘記增加一個end結尾。
如果工程中有多個target要引用,可以參考下面的鏈接進行處理:
http://www.cnblogs.com/wujy/p/5545680.html
本文參考了 博客園 踏浪帥的博主的文章:更新Cocopods碰到的問題及知識點,上面鏈接就是此片博文的地址。