fix(ios): 改用自动签名,修复 archive/export 证书-profile 不配对
本机 login keychain 的 Apple Distribution 证书(2027 有效)与项目里写死的 手动 profile "Jiu App Store"(用另一张/旧证书签发)不配对,archive/export 报 "Provisioning profile doesn't include signing certificate"。 - project.pbxproj:Runner Release 配置 Manual → Automatic(删写死的 PROVISIONING_PROFILE_SPECIFIER + Apple Distribution identity),与项目其它 配置、local_test.sh --ios 一致,由 Xcode 现场配对当前证书。 - compile-ios.sh:ExportOptions signingStyle manual → automatic,去掉手动 profile 发现逻辑(不再依赖会漂移的手动材料)。 验证:本机 sh scripts/ci/compile-ios.sh client-v1.1.9 → 构建 岩美酒库.ipa → altool 上传成功(build 10109 已上 TestFlight,Delivery UUID 4bda0191)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -697,10 +697,8 @@
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.yanmei.jiu;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = BYL4KQHMTN;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "Jiu App Store";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Distribution";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
|
||||
+11
-26
@@ -54,29 +54,16 @@ WORK="$(mktemp -d)"
|
||||
# shellcheck disable=SC2064
|
||||
trap "rm -rf '$WORK'" EXIT
|
||||
|
||||
# --- 自动发现已装的 App Store 分发 profile(AppID=TEAM.BUNDLE、无 ProvisionedDevices)---
|
||||
PROFILE_NAME=""
|
||||
PDIR="$HOME/Library/MobileDevice/Provisioning Profiles"
|
||||
if [ -d "$PDIR" ]; then
|
||||
for p in "$PDIR"/*.mobileprovision; do
|
||||
[ -e "$p" ] || continue
|
||||
plist="$(security cms -D -i "$p" 2>/dev/null)" || continue
|
||||
appid="$(printf '%s' "$plist" | /usr/libexec/PlistBuddy -c 'Print :Entitlements:application-identifier' /dev/stdin 2>/dev/null || true)"
|
||||
# App Store profile:AppID 匹配且无 ProvisionedDevices(区别于开发/AdHoc profile)
|
||||
if [ "$appid" = "${TEAM_ID}.${BUNDLE_ID}" ] \
|
||||
&& ! printf '%s' "$plist" | /usr/libexec/PlistBuddy -c 'Print :ProvisionedDevices' /dev/stdin >/dev/null 2>&1; then
|
||||
PROFILE_NAME="$(printf '%s' "$plist" | /usr/libexec/PlistBuddy -c 'Print :Name' /dev/stdin 2>/dev/null || true)"
|
||||
[ -n "$PROFILE_NAME" ] && break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
[ -n "$PROFILE_NAME" ] || PROFILE_NAME="Jiu App Store" # 已知已装 profile 名兜底
|
||||
echo "==> compile-ios: 使用 provisioning profile '${PROFILE_NAME}'"
|
||||
|
||||
# --- 同步版本号 ---
|
||||
sed -i '' "s/^version:.*/version: ${VER}+${BUILD}/" client/pubspec.yaml
|
||||
|
||||
# --- ExportOptions.plist(manual 签名,app-store 分发)---
|
||||
# --- ExportOptions.plist(automatic 签名,app-store 分发)---
|
||||
# 本机 login 里的 Apple Distribution 证书与旧的手动 profile 不配对
|
||||
# (profile 是用另一张/旧证书签发的 → archive 报 "profile doesn't include
|
||||
# signing certificate")。改用**自动签名**:Xcode 用登录的 Apple ID +
|
||||
# App Store Connect API key(见下 xcodebuild -authenticationKeyPath) 现场
|
||||
# 生成/更新与当前证书匹配的 App Store profile(-allowProvisioningUpdates),
|
||||
# 与 local_test.sh --ios 一致,避免手动材料漂移。
|
||||
cat > "$WORK/ExportOptions.plist" <<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
@@ -84,18 +71,16 @@ cat > "$WORK/ExportOptions.plist" <<EOF
|
||||
<dict>
|
||||
<key>method</key><string>app-store</string>
|
||||
<key>teamID</key><string>${TEAM_ID}</string>
|
||||
<key>signingStyle</key><string>manual</string>
|
||||
<key>signingStyle</key><string>automatic</string>
|
||||
<key>uploadBitcode</key><false/>
|
||||
<key>uploadSymbols</key><true/>
|
||||
<key>provisioningProfiles</key>
|
||||
<dict>
|
||||
<key>${BUNDLE_ID}</key><string>${PROFILE_NAME}</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
# --- 构建签名 IPA(用 login keychain 的分发证书 + 上面的 profile)---
|
||||
# --- 构建签名 IPA(自动签名;Xcode 现场配对证书+profile)---
|
||||
# flutter build ipa 的 archive/export 都会带 -allowProvisioningUpdates(自动签名时),
|
||||
# 但云端/无交互登录需用 API key 授权 provisioning 更新 → 传 -authenticationKeyPath 等。
|
||||
cd client
|
||||
flutter build ipa --release \
|
||||
--build-name="${VER}" \
|
||||
|
||||
Reference in New Issue
Block a user