Xcode 15.0.1运行模拟器报
Building for 'iOS-simulator', but linking in object file (/Users/XXXX/Desktop/XXXX/XXXX/Pods/YYKit/Vendor/WebP.framework/WebP[arm64]4) built for 'iOS'问题解决
升级Xcode15.0.1项目可以在真机上运行,跑模拟器时报Building for 'iOS-simulator', but linking in object file (/Users/XXXX/Desktop/XXXX/XXXX/Pods/YYKit/Vendor/WebP.framework/WebP[arm64][4](bit_reader.o)) built for 'iOS'
这提示是Pod文件中的Framework有问题
Linker command failed with exit code 1 (use -v to see invocation)
如下图
解决:
1.打开 TARGET → 项目→ Build Settings 找到 Excluded Architectures
配置(Debug、Release)Any iOS Simulator SDK ——> arm64
(如果出现设置了arm64但是没有显示的情况可以删除重新添加多试几次)
2.在Podfile文件最后一个end后面添加下面的代码,添加后通过终端执行一次pod install
重新运行项目就可以了
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
避免每次Pod install 后 Pod的配置文件复原
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
end
end
end