Xcode12 模拟运行提示" XXXbuilding for iOS Simulator, but linking in object file built for iOS, for arch...

项目在Xcode11上运行没有任何问题,真机模拟器跑起来电脑飕飕的响,后面升级Xcode12 一直真机在测试,某天突然脑子灵光一闪,想看看Xcode12模拟器是不是也华丽升级了,结果模拟器编译一直报错,提示如下:
···
ld: in /Users/****/Documents/projectGit/PetrifactionCollection/CollectionProject/Pods/YYKit/Vendor/WebP.framework/WebP(libwebpencode_la-config.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
···
网上检索了半天,各种方法东拼西凑,最总解决了,现把方法记录如下:
至于原因,大家应该都知道了,这里就不再赘述了,
直接上方法:
1.先是:Excluded Architectures 中分别设置 各种配置(Debug、Release 等)添加子项目:Any iOS Simulator SDK ----> arm64
如下图所示:


截屏2021-05-28 下午3.23.03.png

2.然后这提示是Pod文件中的Framework有问题 我们还得Pod文件中在做上面同样的修改,但是这样有个弊端,就是每次Pod install 后 Pod的配置文件就复原了,所以一步到位的方法是:
直接在Podfile中直接添加如下代码

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end
end

注意 直接放在最后就行了,然后在模拟器编译就OK了。

你可能感兴趣的:(Xcode12 模拟运行提示" XXXbuilding for iOS Simulator, but linking in object file built for iOS, for arch...)