運行舊項目時遇到問題:
xxx/Pods/Target Support Files/Pods-xxx/Pods-xxx-frameworks.sh: line 128: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code
或者
The linked library 'xxxx.a/Framework' is missing one or more architectures required by this target: armv7.
解決方案1:
在訪達(dá)的應(yīng)用程序列表中,找到xcode,右鍵選擇顯示簡介,然后勾選“使用Rosetta打開”。
image.png
這種方法最簡單粗暴,什么代碼都不用改,但是因為要再經(jīng)過Rosetta轉(zhuǎn)譯,會影響執(zhí)行效率,也會增加電池的續(xù)航。不推薦這一種方法,只是在最后沒有解決辦法的時候使用。
解決方案2:
在Target-Build Settings-Excluded Architectures中添加以下代碼
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8 EXCLUDED_ARCHS=
(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_
(NATIVE_ARCH_64_BIT))
但是運行之后還是會提示 arm64 的問題,所以在 Debug 哪里多加一個 arm64 ,Release 是不需要的,不然打包會報錯。
如果還是不行就是在 podfile 中加入下列代碼,重新pod install
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
解決方案3:
直接用真機運行