From 709e59b1b729f2cbf88915a1289aeb088d2db731 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Sat, 11 Jul 2026 12:18:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(scripts):=20local=5Ftest.sh=20--ios=20?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E4=B8=8D=E5=88=B0=E5=B7=B2=E8=BF=9E=20iPhone?= =?UTF-8?q?=E2=80=94=E2=80=94=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=20connected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新版 Xcode devicectl 对 USB 直连并解锁的 iPhone 显示状态 'connected',脚本原来只筛 'available (paired)'(该状态在新版仅配对未直连的设备如 Apple Watch 才有),导致 '未检测到已配对 iPhone'。改为 grep iPhone 行 + 词匹配 connected|available(两版 Xcode 都收,-w 避免误命中 disconnected/unavailable)。 Co-Authored-By: Claude Fable 5 --- scripts/local_test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/local_test.sh b/scripts/local_test.sh index 0f0e3e3..b42d303 100755 --- a/scripts/local_test.sh +++ b/scripts/local_test.sh @@ -53,7 +53,9 @@ if [ "${1:-}" = "--ios" ]; then cd client flutter build ios --release --config-only "${DEFINES[@]}" cd ios - CD_ID="$(xcrun devicectl list devices 2>/dev/null | grep 'available (paired)' | grep 'iPhone' | grep -oE '[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}' | head -1 || true)" + # 已配对可安装的 iPhone:新版 Xcode(devicectl) USB 直连并解锁显示 "connected", + # 旧版曾显示 "available (paired)";两者都收。-w 词匹配避免误命中 disconnected/unavailable。 + CD_ID="$(xcrun devicectl list devices 2>/dev/null | grep 'iPhone' | grep -Ew 'connected|available' | grep -oE '[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}' | head -1 || true)" if [ -z "$CD_ID" ]; then echo "!! 未检测到已配对 iPhone(插线并解锁后重试)" >&2 exit 1