最近在用cocoapods導(dǎo)入第三方庫(kù)的時(shí)候出現(xiàn)如下錯(cuò)誤亭引,現(xiàn)在將錯(cuò)誤處理放發(fā)一步步貼出來:
1欺栗、當(dāng)導(dǎo)入一些第三方庫(kù)的時(shí)候如:
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穿剖、
當(dāng)你執(zhí)行pod install時(shí)出現(xiàn)了下面的報(bào)錯(cuò):
[!] The `master` repo requires CocoaPods 1.0.0 -? (currently using 0.39.0)
這就是說我們的cocopods版本太舊,是currently using 0.39.0這個(gè),這個(gè)master需要CocoaPods 1.0.0 的版本
2靠瞎、
那執(zhí)行 sudo?gem?update?cocoapods?? 更新cocopods 就又提示了下面這個(gè)錯(cuò)誤:
Updating cocoapods
ERROR:? While executing gem ... (Errno::EPERM)
3、接下來執(zhí)行sudo gem install -n /usr/local/bin cocoapods --pre
就可以成功的更新了cocopods的版本,采用pod —version 查看cocopods的版本號(hào)1.0.0~1.2.0
4志笼、接下來執(zhí)行pod install 的時(shí)候沿盅,又會(huì)出現(xiàn)如下錯(cuò)誤
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.
這個(gè)問題產(chǎn)生的可以通過 $ pod --version 查看版本號(hào);
原因是podfile升級(jí)到最新版本纫溃,pod里的內(nèi)容必須明確指出所用第三方庫(kù)的target腰涧;可以修改Podfile文件的配置文件,讓它兼容不指定固定版本紊浩;且又不報(bào)錯(cuò)窖铡;
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要換成當(dāng)前target名,最后不要忘記增加一個(gè)end結(jié)尾坊谁。
如果工程中有多個(gè)target要引用费彼,可以參考下面的鏈接進(jìn)行處理:
http://www.cnblogs.com/wujy/p/5545680.html
本文參考了 博客園 踏浪帥的博主的文章:更新Cocopods碰到的問題及知識(shí)點(diǎn),上面鏈接就是此片博文的地址口芍。