Xcode升级12编译报错The linked library is missing one or more architectures required by this target

问题

升级 Xcode12 后编译报错,报错提示类似:

1
The linked library 'xxxx.a/Framework' is missing one or more architectures required by this target: armv7.

又或者:

1
2
xxx/Pods/Target Support Files/Pods-xxx/Pods-xxx-frameworks.sh: line 128: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

解决方案

在 TARGETS ——> Build Settings-Excluded Architectures 中添加以下代码:

1
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8 EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))

保存后重新编译即可。