代码在真机上是可以编译通过的,换成模拟器就会出现以下报错

或者

解决方案:
一.添加arm64到项目PEROJECT和TARGETS的Excluded Architectures中
路径1:PEROJECT - Build Settings - Excluded Architectures
路径2:TARGETS - Build Settings - Excluded Architectures
如图

二.在项目的podfile的最后添加以下代码
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end