一、为什么要升级到10.15 Beta?
随着9月份的到来,iOS13正式版也会随之到来,为了提前适配iOS13,因此需要提前适配一下,我在我们组内就光荣的接下了这个任务。
目前最新的iOS 13 beta 5,但是为了能够调试,需要Xcode10 beta5, 但是要是能够安装Xcode10 beta5, 就需要把系统升级到10.15 Beta, 因此就直接升级了,同时也随之下载安装了Xcode10 beta5。
二、 问题解决之路
当经过几个小时,安装完系统和Xcode之后,当我打开我们的项目需要pod update的时候,就报错了
/Users/zhouwenchao/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-1.7.3/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version` ("xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n") (RuntimeError)
from /Users/zhouwenchao/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-1.7.3/lib/cocoapods/command.rb:130:in `verify_minimum_git_version!'
from /Users/zhouwenchao/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-1.7.3/lib/cocoapods/command.rb:49:in `run'
from /Users/zhouwenchao/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-1.7.3/bin/pod:55:in `<top (required)>'
from /Users/zhouwenchao/.rvm/gems/ruby-2.3.0/bin/pod:23:in `load'
from /Users/zhouwenchao/.rvm/gems/ruby-2.3.0/bin/pod:23:in `<main>'
from /Users/zhouwenchao/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:24:in `eval'
from /Users/zhouwenchao/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:24:in `<main>'
然后我以为是cocopods的问题,然后,我就
sudo gem uninstall cocoapods -v 1.7.3
sudo gem install cocoapods -v 1.7.5
但是问题还是没有解决,pod --version
当我执行完这个命令的时候,一直报下面这个错误。
Could not find proper version of cocoapods (1.7.3) in any of the sources
Run `bundle install` to install missing gems.
然后我就按照他的提示,执行 bundle install
,但是一直没有反应,然后就在网上查了查可能是网络的问题,因此我就用4G流量试了一下,果然是开始安装了,但是到最后的时候,又报了一个新的错误。
An error occurred while installing unf_ext (0.0.7.6), and Bundler cannot continue.
Make sure that `gem install unf_ext -v '0.0.7.6' --source 'https://rubygems.org/'` succeeds before
bundling.
In Gemfile:
fastlane was resolved to 2.116.0, which depends on
faraday-cookie_jar was resolved to 0.0.6, which depends on
http-cookie was resolved to 1.0.3, which depends on
domain_name was resolved to 0.5.20180417, which depends on
unf was resolved to 0.1.4, which depends on
unf_ext
然后按照他提示的好像是gem的源不对,然后我看了一下我的gem 源,发现只有
https://gems.ruby-china.com/
然后我又按照他说的,执行了一下
gem source -a https://rubygems.org/
当源安装成功之后,我又执行了一次 bundle install
,发现还是报错还是报上面同样的错误。然后我又按照上面说的执行了下面这条命令,发现还是执行失败。
gem install unf_ext -v '0.0.7.6
这个就把我搞晕了,然后网上查了好久,终于在看到了https://github.com/knu/ruby-unf_ext/issues/40 这篇文章关于ruby-unf_ext
的问题,里面有个人的回答,一下子惊醒了我,有个答案回答的是sudo xcode-select -r
,我顿时才明白过来,我电脑上装了Xcode 10.2 和 Xcode 11 beta5, 然后我又执行了
sudo xcode-select -r
终于解决了,然后我再次输入pod --version 的时候
pod --version
1.7.5
终于解决了,可以开心的开始IOS 13 踩坑之旅了。