From b682b7ea88b185b5d79fae8508af7013c9f39bbf Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Tue, 7 Jul 2026 14:28:18 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20iOS=20=E4=B8=B4=E6=97=B6=E9=92=A5?= =?UTF-8?q?=E5=8C=99=E4=B8=B2=E8=A1=A5=E5=AF=BC=20WWDR=20=E4=B8=AD?= =?UTF-8?q?=E9=97=B4=E8=AF=81=E4=B9=A6=E2=80=94=E2=80=94=E4=BF=AE=E7=8B=AC?= =?UTF-8?q?=E5=8D=A0=E6=90=9C=E7=B4=A2=E5=88=97=E8=A1=A8=E5=90=8E=20unable?= =?UTF-8?q?=20to=20build=20chain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit p12 只含叶子证书;独占后 login 里的 Apple WWDR 中间证书不可见, codesign 报 errSecInternalComponent。建 keychain 时从本机 login/System 导出 WWDR(纯公钥)一并导入。 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o --- scripts/ci/compile-ios.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/ci/compile-ios.sh b/scripts/ci/compile-ios.sh index d7ecaaa..33512d5 100755 --- a/scripts/ci/compile-ios.sh +++ b/scripts/ci/compile-ios.sh @@ -55,6 +55,17 @@ security unlock-keychain -p "$KEYCHAIN_PWD" "$KEYCHAIN" echo "${IOS_DIST_CERT_P12_BASE64}" | base64 --decode > "$WORK/dist.p12" security import "$WORK/dist.p12" -k "$KEYCHAIN" \ -P "${IOS_DIST_CERT_PASSWORD:-}" -T /usr/bin/codesign -T /usr/bin/security +# 补齐证书链:p12 只含叶子证书,独占搜索列表后 login 里的 Apple WWDR 中间证书 +# 不可见会报 errSecInternalComponent(unable to build chain)——把本机已有的 +# WWDR 中间证书(纯公钥)一并导入临时 keychain。 +security find-certificate -a -c "Apple Worldwide Developer Relations" -p \ + ~/Library/Keychains/login.keychain-db /Library/Keychains/System.keychain \ + > "$WORK/wwdr.pem" 2>/dev/null || true +if [ -s "$WORK/wwdr.pem" ]; then + security import "$WORK/wwdr.pem" -k "$KEYCHAIN" -T /usr/bin/codesign 2>/dev/null || true +else + echo "WARN: 本机未找到 Apple WWDR 中间证书,签名可能报 unable to build chain" >&2 +fi # 允许 codesign 非交互访问私钥 security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PWD" "$KEYCHAIN" >/dev/null # 构建期独占搜索列表(fastlane 同款):只见临时 keychain,隔离本机其他项目的