由于新版编译方式的问题导致该问题,解决方案:
方案一:
1、进入以下路径修改方式xcode--file--Workspace Settings--Build System--legacy Build System(使用传统构建方式)
2、修改完成后可能会报错library not found for -lstdc++.6.0.9需删除。如果是第三方SDK中存在依赖那就只能联系第三方了。
综上不推荐方案一,仅为临时解决方案
方案二:(亲测已解决)推荐
cocoapods版本过低对其进行升级具体操作如下:
1、关闭xcode,确保已经完全退出
2、打开终端执行指令查看当前cocopods版本:
pod --version
3、执行指令更新cocoapods
pod setup
sudo gem install cocoapods
安装过程中可能会遇到的问题(如没问题请忽略直接看第4条):
问题一:
ERROR: Could not find a valid gem 'cocoapods'(>= 0), here is why: Unable to download data fromhttps://ruby.taobao.org/ - bad response Not Found 404(https://gems.ruby-china.org/specs.4.8.gz)
或者
ERROR: Could not find a valid gem 'cocoapods'(>= 0), here is why: Unable to download data fromhttps://gems.ruby-china.org/ - bad response Not Found 404(https://gems.ruby-china.org/specs.4.8.gz)
这是因为gem源已经停止维护,之前是淘宝的,或者老版本ruby-china提供的服务需要把.org改成.com
执行指令查看镜像源:
gem sources -l
执行指令修改镜像源:
gem sources --remove https://ruby.taobao.org/
sudo gem sources -a https://gems.ruby-china.com/
问题二:
执行sudo gem install cocoapods时出现While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
执行指令:sudo gem install -n /usr/local/bin cocoapods 即可
4、cocoapods更新完成后,进入APP项目所在的podfile所在目录,将pod数据进行解体清理再重新pod
(1)安装cocoapods插件:
sudo gem install cocoapods-deintegrate//解体
sudo gem install cocoapods-clean//清理
(2)清理:
pod deintegrate
pod clean
(3)重新install
pod install
以上步骤完成后重新打开xcode12编译项目,问题解决!
注意:pod操作一对一,其他旧项目出现此问题也需要完全关闭xcode执行以下指令即可:
pod deintegrate
pod clean
pod install