最近Xcode更新到14.1版本,cocoapods出现了一些问题,借此记录下:
运行pod初始化命令pod init
;
返回错误内容如下:
经过完全卸载重装等各种尝试,报错依旧,不能解决问题。
于是直接在GitHub看cocoapods仓库的issues找相似问题和解决答案。
找到一个有效的答案:
sudo gem update xcodeproj
或
sudo gem install xcodeproj
该命令升级了cocoapods支持的Xcode版本。
记录下其他相关命令
完全卸载cocoapods
sudo gem uninstall -n /usr/local/bin cocoapods cocoapods-core cocoapods-deintegrate cocoapods-downloader cocoapods-plugins cocoapods-search cocoapods-stats cocoapods-trunk cocoapods-try
解决安装后冲突的命令:
# Target /usr/local/bin/xcodeproj
# already exists. You may want to remove it:
rm '/usr/local/bin/xcodeproj'
# To force the link and overwrite all conflicting files:
brew link --overwrite cocoapods
# To list all files that would be deleted:
brew link --overwrite --dry-run cocoapods
初始化cocoaspod组件报错
Could not find 'rexml' (~> 3.2.4) among 38 total gem(s) (Gem::MissingSpecError)
解决方案:
gem install --user-install rexml
gem install --user-install xcodeproj
再去执行pod lib create XXX
即可