CocoaPods系列:CocoaPods报错
2019-08-15 本文已影响0人
JQWONG
报错一
- 错误信息
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `master`.
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.
- 解决方法
$ pod repo add master https://github.com/CocoaPods/Specs.git
//- 如果之后出现'pod setup'提示
$ pod setup
//- 如果pod setup不能解决问题
$ Git clone [https://git.coding.net/CocoaPods/Specs.git](https://git.coding.net/CocoaPods/Specs.git) ~/.cocoapods/repos/master
报错二
项目的Swift版本升级后,第三方库若没支持项目的Swift会出现报错
-
解决方法一
Pods -> Targets -> SnapKit -> Build Settings -> Swift language version option 选择第三方库可以支持的版本
- 解决方法二
post_install do |installer|
installer.pods_project.targets.each do |target|
if ['SnapKit'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
end
SnapKit只是一个例子,换成项目中有问题的库即可
记得要保存然后pod install
持续更新