☠️ M1 Xcode 引入 UMCommon 时报错 arm64 兼容问题

2023/11/26

问题参考:https://juejin.cn/post/7037037120158269448

问题

解决办法:

  1. profile 文件上添加钩子

post_install do |installer|
	installer.pods_project.targets.each do |target|
		# 友盟框架兼容问题
		if target.name == 'UMCommon' || target.name == 'UMDevice'
			target.build_configurations.each do |config|
				config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
			end
		end
		
		target.build_configurations.each do |config| 
			config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
			config.build_settings['ARCHS[sdk=iphonesimulator*]'] = 'x86_64'
		end
	end
end

  1. 在项目 target - Build Settings - Architectures - Excluded Architectures Debug 添加 Any iOS Simulator SDK: arm64